Skip to content

Commit 050cc50

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent f08c7f5 commit 050cc50

File tree

9 files changed

+124
-272
lines changed

9 files changed

+124
-272
lines changed

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from setuptools import setup, find_packages
44

5-
65
setup(
76
name="pytest-qt",
87
packages=find_packages(where="src"),

src/pytestqt/modeltest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747
from pytestqt.qt_compat import qt_api
4848

49-
5049
_Changing = collections.namedtuple("_Changing", "parent, old_size, last, next")
5150

5251

src/pytestqt/qt_compat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import pytest
1616

17-
1817
VersionTuple = namedtuple("VersionTuple", "qt_api, qt_api_version, runtime, compiled")
1918

2019
QT_APIS = OrderedDict()

tests/test_basics.py

Lines changed: 38 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -26,75 +26,62 @@ def test_qapp_default_name(qapp):
2626

2727

2828
def test_qapp_name(testdir):
29-
testdir.makepyfile(
30-
"""
29+
testdir.makepyfile("""
3130
def test_name(qapp):
3231
assert qapp.applicationName() == "frobnicator"
33-
"""
34-
)
35-
testdir.makeini(
36-
"""
32+
""")
33+
testdir.makeini("""
3734
[pytest]
3835
qt_qapp_name = frobnicator
39-
"""
40-
)
36+
""")
4137
res = testdir.runpytest_subprocess()
4238
res.stdout.fnmatch_lines("*1 passed*")
4339

4440

4541
def test_qapp_cls(testdir):
46-
testdir.makepyfile(
47-
app="""
42+
testdir.makepyfile(app="""
4843
from pytestqt.qt_compat import qt_api
4944
5045
# Gets run before the plugin via conftest.py
5146
qt_api.set_qt_api(None)
5247
5348
class CustomQApp(qt_api.QtWidgets.QApplication):
5449
pass
55-
"""
56-
)
57-
testdir.makeconftest(
58-
"""
50+
""")
51+
testdir.makeconftest("""
5952
import pytest
6053
from app import CustomQApp
6154
6255
@pytest.fixture(scope="session")
6356
def qapp_cls():
6457
return CustomQApp
65-
"""
66-
)
67-
testdir.makepyfile(
68-
"""
58+
""")
59+
testdir.makepyfile("""
6960
from app import CustomQApp
7061
7162
def test_cls(qapp):
7263
assert isinstance(qapp, CustomQApp)
73-
"""
74-
)
64+
""")
7565
res = testdir.runpytest_subprocess()
7666
res.stdout.fnmatch_lines("*1 passed*")
7767

7868

7969
def test_qapp_reuse_existing(testdir):
80-
testdir.makepyfile(
81-
"""
70+
testdir.makepyfile("""
8271
from pytestqt.qt_compat import qt_api
8372
8473
app_instance = qt_api.QtWidgets.QApplication([])
8574
8675
def test_instances(qapp):
8776
assert qapp is app_instance
8877
assert qapp is qt_api.QtWidgets.QApplication.instance()
89-
"""
90-
)
78+
""")
9179
res = testdir.runpytest_subprocess()
9280
res.stdout.fnmatch_lines("*1 passed*")
9381

9482

9583
def test_qapp_reuse_wrong_type(testdir):
96-
testdir.makeconftest(
97-
"""
84+
testdir.makeconftest("""
9885
import pytest
9986
from pytestqt.qt_compat import qt_api
10087
@@ -107,18 +94,15 @@ class CustomQApp(qt_api.QtWidgets.QApplication):
10794
@pytest.fixture(scope="session")
10895
def qapp_cls():
10996
return CustomQApp
110-
"""
111-
)
112-
testdir.makepyfile(
113-
"""
97+
""")
98+
testdir.makepyfile("""
11499
from pytestqt.qt_compat import qt_api
115100
116101
app_instance = qt_api.QtWidgets.QApplication([])
117102
118103
def test_wrong_type(qapp):
119104
pass
120-
"""
121-
)
105+
""")
122106
res = testdir.runpytest_subprocess()
123107
res.stdout.fnmatch_lines(
124108
"*Existing QApplication <*.QtWidgets.QApplication* at 0x*> is not an "
@@ -267,8 +251,7 @@ def test_event_processing_before_and_after_teardown(testdir):
267251
268252
https://github.com/pytest-dev/pytest-qt/issues/67
269253
"""
270-
testdir.makepyfile(
271-
"""
254+
testdir.makepyfile("""
272255
from pytestqt.qt_compat import qt_api
273256
import pytest
274257
@@ -303,8 +286,7 @@ def test_events(events_queue, fix, i):
303286
assert events_queue.events == []
304287
events_queue.events.append('test event')
305288
events_queue.pop_later()
306-
"""
307-
)
289+
""")
308290
res = testdir.runpytest()
309291
res.stdout.fnmatch_lines(["*3 passed in*"])
310292

@@ -340,8 +322,7 @@ def test_widgets_closed_before_fixtures(testdir):
340322
Ensure widgets added by "qtbot.add_widget" are closed before all other
341323
fixtures are teardown. (#106).
342324
"""
343-
testdir.makepyfile(
344-
"""
325+
testdir.makepyfile("""
345326
import pytest
346327
from pytestqt.qt_compat import qt_api
347328
@@ -362,8 +343,7 @@ def widget(qtbot):
362343
363344
def test_foo(widget):
364345
pass
365-
"""
366-
)
346+
""")
367347
result = testdir.runpytest()
368348
result.stdout.fnmatch_lines(["*= 1 passed in *"])
369349

@@ -440,23 +420,17 @@ def test_qt_api_ini_config(testdir, monkeypatch, option_api):
440420

441421
monkeypatch.delenv("PYTEST_QT_API", raising=False)
442422

443-
testdir.makeini(
444-
"""
423+
testdir.makeini("""
445424
[pytest]
446425
qt_api={option_api}
447-
""".format(
448-
option_api=option_api
449-
)
450-
)
426+
""".format(option_api=option_api))
451427

452-
testdir.makepyfile(
453-
"""
428+
testdir.makepyfile("""
454429
import pytest
455430
456431
def test_foo(qtbot):
457432
pass
458-
"""
459-
)
433+
""")
460434

461435
result = testdir.runpytest_subprocess()
462436
if qt_api.pytest_qt_api == option_api:
@@ -475,25 +449,19 @@ def test_foo(qtbot):
475449
@pytest.mark.parametrize("envvar", ["pyqt5", "pyqt6", "pyside6"])
476450
def test_qt_api_ini_config_with_envvar(testdir, monkeypatch, envvar):
477451
"""ensure environment variable wins over config value if both are present"""
478-
testdir.makeini(
479-
"""
452+
testdir.makeini("""
480453
[pytest]
481454
qt_api={option_api}
482-
""".format(
483-
option_api="piecute"
484-
)
485-
)
455+
""".format(option_api="piecute"))
486456

487457
monkeypatch.setenv("PYTEST_QT_API", envvar)
488458

489-
testdir.makepyfile(
490-
"""
459+
testdir.makepyfile("""
491460
import pytest
492461
493462
def test_foo(qtbot):
494463
pass
495-
"""
496-
)
464+
""")
497465

498466
result = testdir.runpytest_subprocess()
499467
if qt_api.pytest_qt_api == envvar:
@@ -513,14 +481,12 @@ def test_invalid_qt_api_envvar(testdir, monkeypatch):
513481
"""
514482
Make sure the error message with an invalid PYQTEST_QT_API is correct.
515483
"""
516-
testdir.makepyfile(
517-
"""
484+
testdir.makepyfile("""
518485
import pytest
519486
520487
def test_foo(qtbot):
521488
pass
522-
"""
523-
)
489+
""")
524490
monkeypatch.setenv("PYTEST_QT_API", "piecute")
525491
result = testdir.runpytest_subprocess()
526492
result.stderr.fnmatch_lines(
@@ -532,21 +498,17 @@ def test_qapp_args(testdir):
532498
"""
533499
Test customizing of QApplication arguments.
534500
"""
535-
testdir.makeconftest(
536-
"""
501+
testdir.makeconftest("""
537502
import pytest
538503
539504
@pytest.fixture(scope='session')
540505
def qapp_args():
541506
return ['prog_name', '--test-arg']
542-
"""
543-
)
544-
testdir.makepyfile(
545-
"""
507+
""")
508+
testdir.makepyfile("""
546509
def test_args(qapp):
547510
assert '--test-arg' in list(qapp.arguments())
548-
"""
549-
)
511+
""")
550512
result = testdir.runpytest_subprocess()
551513
result.stdout.fnmatch_lines(["*= 1 passed in *"])
552514

@@ -556,13 +518,11 @@ def test_qapp_args_default(testdir):
556518
Test QApplication default arguments.
557519
"""
558520

559-
testdir.makepyfile(
560-
"""
521+
testdir.makepyfile("""
561522
def test_args(qapp):
562523
args = qapp.arguments()
563524
assert args[0] == 'pytest-qt-qapp'
564-
"""
565-
)
525+
""")
566526
result = testdir.runpytest_subprocess()
567527
result.stdout.fnmatch_lines(["*= 1 passed in *"])
568528

@@ -660,8 +620,7 @@ def test_before_close_func(testdir):
660620
"""
661621
import sys
662622

663-
testdir.makepyfile(
664-
"""
623+
testdir.makepyfile("""
665624
import sys
666625
import pytest
667626
from pytestqt.qt_compat import qt_api
@@ -679,8 +638,7 @@ def widget(qtbot):
679638
680639
def test_foo(widget):
681640
pass
682-
"""
683-
)
641+
""")
684642
result = testdir.runpytest_inprocess()
685643
result.stdout.fnmatch_lines(["*= 1 passed in *"])
686644
assert sys.pytest_qt_widget_closed

0 commit comments

Comments
 (0)