Skip to content

Commit 77c8153

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

15 files changed

Lines changed: 115 additions & 261 deletions

src/pytest_selenium/drivers/saucelabs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,7 @@ def _video_html(session):
146146
"url":"https://assets.saucelabs.com/jobs/{session}/video.flv",\
147147
"provider":"streamer",\
148148
"autoPlay":false,\
149-
"autoBuffering":true}}]}}'.format(
150-
session=session
151-
)
149+
"autoBuffering":true}}]}}'.format(session=session)
152150

153151
return (
154152
f'<div id="player{session}" style="border:1px solid #e6e6e6; float:right; height:240px; margin-left:5px;'

testing/test_browserstack.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515

1616
@pytest.fixture
1717
def testfile(testdir):
18-
return testdir.makepyfile(
19-
"""
18+
return testdir.makepyfile("""
2019
import pytest
2120
@pytest.mark.nondestructive
2221
def test_pass(selenium): pass
23-
"""
24-
)
22+
""")
2523

2624

2725
def failure_with_output(testdir, *args, **kwargs):
@@ -107,18 +105,14 @@ def test_default_caps_in_jsonwp(monkeypatch, testdir):
107105
variables = testdir.makefile(
108106
".json", '{{"capabilities": {}}}'.format(json.dumps(capabilities))
109107
)
110-
file_test = testdir.makepyfile(
111-
"""
108+
file_test = testdir.makepyfile("""
112109
import pytest
113110
@pytest.mark.nondestructive
114111
def test_bstack_capabilities(driver_kwargs):
115112
assert driver_kwargs['options'].capabilities['browserstack.user'] == 'foo'
116113
assert driver_kwargs['options'].capabilities['browserstack.key'] == 'bar'
117114
assert driver_kwargs['options'].capabilities['name'] == '{0}'
118-
""".format(
119-
test_name
120-
)
121-
)
115+
""".format(test_name))
122116
testdir.quick_qa(
123117
"--driver", "BrowserStack", "--variables", variables, file_test, passed=1
124118
)
@@ -131,16 +125,14 @@ def test_default_caps_in_jsonwp_with_conflict(monkeypatch, testdir):
131125
variables = testdir.makefile(
132126
".json", '{{"capabilities": {}}}'.format(json.dumps(capabilities))
133127
)
134-
file_test = testdir.makepyfile(
135-
"""
128+
file_test = testdir.makepyfile("""
136129
import pytest
137130
@pytest.mark.nondestructive
138131
def test_bstack_capabilities(driver_kwargs):
139132
assert driver_kwargs['options'].capabilities['browserstack.user'] == 'foo'
140133
assert driver_kwargs['options'].capabilities['browserstack.key'] == 'bar'
141134
assert driver_kwargs['options'].capabilities['name'] == 'conflicting_name'
142-
"""
143-
)
135+
""")
144136
testdir.quick_qa(
145137
"--driver", "BrowserStack", "--variables", variables, file_test, passed=1
146138
)
@@ -153,8 +145,7 @@ def test_default_caps_in_W3C(monkeypatch, testdir):
153145
variables = testdir.makefile(
154146
".json", '{{"capabilities": {}}}'.format(json.dumps(capabilities))
155147
)
156-
file_test = testdir.makepyfile(
157-
"""
148+
file_test = testdir.makepyfile("""
158149
import pytest
159150
@pytest.mark.nondestructive
160151
def test_bstack_capabilities(driver_kwargs):
@@ -163,8 +154,7 @@ def test_bstack_capabilities(driver_kwargs):
163154
'accessKey': 'bar',
164155
'sessionName': 'test_default_caps_in_W3C.test_bstack_capabilities'
165156
}
166-
"""
167-
)
157+
""")
168158
testdir.quick_qa(
169159
"--driver", "BrowserStack", "--variables", variables, file_test, passed=1
170160
)
@@ -180,8 +170,7 @@ def test_default_caps_in_W3C_with_conflict(monkeypatch, testdir):
180170
variables = testdir.makefile(
181171
".json", '{{"capabilities": {}}}'.format(json.dumps(capabilities))
182172
)
183-
file_test = testdir.makepyfile(
184-
"""
173+
file_test = testdir.makepyfile("""
185174
import pytest
186175
@pytest.mark.nondestructive
187176
def test_bstack_capabilities(driver_kwargs):
@@ -190,8 +179,7 @@ def test_bstack_capabilities(driver_kwargs):
190179
'accessKey': 'bar',
191180
'sessionName': 'conflicting_name'
192181
}
193-
"""
194-
)
182+
""")
195183
testdir.quick_qa(
196184
"--driver", "BrowserStack", "--variables", variables, file_test, passed=1
197185
)

testing/test_capabilities.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111

1212
@pytest.fixture
1313
def testfile(testdir):
14-
return testdir.makepyfile(
15-
"""
14+
return testdir.makepyfile("""
1615
import pytest
1716
@pytest.mark.nondestructive
1817
def test_capabilities(capabilities):
1918
assert capabilities['foo'] == 'bar'
20-
"""
21-
)
19+
""")
2220

2321

2422
def test_command_line(testfile, testdir):
@@ -36,43 +34,35 @@ def test_file_remote(testdir):
3634
variables = testdir.makefile(
3735
".json", '{{"capabilities": {}}}'.format(json.dumps(capabilities))
3836
)
39-
file_test = testdir.makepyfile(
40-
"""
37+
file_test = testdir.makepyfile("""
4138
import pytest
4239
@pytest.mark.nondestructive
4340
def test_capabilities(session_capabilities, capabilities):
4441
assert session_capabilities['{0}']['args'] == ['foo']
4542
assert capabilities['{0}']['args'] == ['foo']
46-
""".format(
47-
key
48-
)
49-
)
43+
""".format(key))
5044
testdir.quick_qa(
5145
"--driver", "Remote", "--variables", variables, file_test, passed=1
5246
)
5347

5448

5549
def test_fixture(testfile, testdir):
56-
testdir.makeconftest(
57-
"""
50+
testdir.makeconftest("""
5851
import pytest
5952
@pytest.fixture(scope='session')
6053
def capabilities():
6154
return {'foo': 'bar'}
62-
"""
63-
)
55+
""")
6456
testdir.quick_qa(testfile, passed=1)
6557

6658

6759
def test_mark(testdir):
68-
file_test = testdir.makepyfile(
69-
"""
60+
file_test = testdir.makepyfile("""
7061
import pytest
7162
@pytest.mark.nondestructive
7263
@pytest.mark.capabilities(foo='bar')
7364
def test_capabilities(session_capabilities, capabilities):
7465
assert 'foo' not in session_capabilities
7566
assert capabilities['foo'] == 'bar'
76-
"""
77-
)
67+
""")
7868
testdir.quick_qa(file_test, passed=1)

testing/test_chrome.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111

1212
@pytest.mark.chrome
1313
def test_launch(testdir):
14-
file_test = testdir.makepyfile(
15-
"""
14+
file_test = testdir.makepyfile("""
1615
import pytest
1716
@pytest.mark.nondestructive
1817
def test_pass(webtext):
1918
assert webtext == u'Success!'
20-
"""
21-
)
19+
""")
2220
testdir.quick_qa(
2321
"--driver",
2422
"Remote",
@@ -32,8 +30,7 @@ def test_pass(webtext):
3230

3331
@pytest.mark.chrome
3432
def test_options(testdir):
35-
testdir.makepyfile(
36-
"""
33+
testdir.makepyfile("""
3734
import pytest
3835
@pytest.fixture
3936
def chrome_options(chrome_options):
@@ -42,8 +39,7 @@ def chrome_options(chrome_options):
4239
4340
@pytest.mark.nondestructive
4441
def test_pass(selenium): pass
45-
"""
46-
)
42+
""")
4743
reprec = testdir.inline_run(
4844
"--driver", "Remote", "--capability", "browserName", "chrome"
4945
)
@@ -56,8 +52,7 @@ def test_pass(selenium): pass
5652
@pytest.mark.xfail(reason="Remote driver currently doesn't support logs")
5753
@pytest.mark.chrome
5854
def test_args(testdir):
59-
file_test = testdir.makepyfile(
60-
"""
55+
file_test = testdir.makepyfile("""
6156
import pytest
6257
@pytest.fixture
6358
def driver_log():
@@ -69,8 +64,7 @@ def driver_args():
6964
7065
@pytest.mark.nondestructive
7166
def test_pass(selenium): pass
72-
"""
73-
)
67+
""")
7468
testdir.quick_qa(
7569
"--driver",
7670
"Remote",

testing/test_crossbrowsertesting.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212

1313
@pytest.fixture
1414
def testfile(testdir):
15-
return testdir.makepyfile(
16-
"""
15+
return testdir.makepyfile("""
1716
import pytest
1817
@pytest.mark.nondestructive
1918
def test_pass(selenium): pass
20-
"""
21-
)
19+
""")
2220

2321

2422
def failure_with_output(testdir, *args, **kwargs):

testing/test_destructive.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,11 @@ def test_skip_destructive_when_sensitive_env(testdir, monkeypatch):
4141

4242

4343
def test_run_non_destructive_by_default(testdir):
44-
file_test = testdir.makepyfile(
45-
"""
44+
file_test = testdir.makepyfile("""
4645
import pytest
4746
@pytest.mark.nondestructive
4847
def test_pass(): pass
49-
"""
50-
)
48+
""")
5149
testdir.quick_qa(file_test, passed=1)
5250

5351

@@ -69,12 +67,10 @@ def test_run_destructive_when_not_sensitive_env(testdir, monkeypatch):
6967

7068

7169
def test_run_destructive_and_non_destructive_when_not_sensitive(testdir):
72-
file_test = testdir.makepyfile(
73-
"""
70+
file_test = testdir.makepyfile("""
7471
import pytest
7572
@pytest.mark.nondestructive
7673
def test_pass1(): pass
7774
def test_pass2(): pass
78-
"""
79-
)
75+
""")
8076
testdir.quick_qa("--sensitive-url", "foo", file_test, passed=2)

0 commit comments

Comments
 (0)