44
55
66def test_fixture (testdir ):
7- testdir .makepyfile (
8- """
7+ testdir .makepyfile ("""
98 import pytest
109 @pytest.fixture(scope='session')
1110 def base_url():
1211 return 'foo'
1312 def test_fixture(base_url):
1413 assert base_url == 'foo'
15- """
16- )
14+ """ )
1715 result = testdir .runpytest ()
1816 assert result .ret == 0
1917
2018
2119def test_cli (testdir ):
22- testdir .makepyfile (
23- """
20+ testdir .makepyfile ("""
2421 def test_funcarg(base_url):
2522 assert base_url == 'foo'
26- """
27- )
23+ """ )
2824 result = testdir .runpytest ("--base-url" , "foo" )
2925 assert result .ret == 0
3026
@@ -37,14 +33,12 @@ def test_config(testdir):
3733 base_url=foo
3834 """ ,
3935 )
40- testdir .makepyfile (
41- """
36+ testdir .makepyfile ("""
4237 def test_config(request, base_url):
4338 assert request.config.getvalue('base_url') == 'foo'
4439 assert request.config.getini('base_url') == 'foo'
4540 assert base_url == 'foo'
46- """
47- )
41+ """ )
4842 result = testdir .runpytest ()
4943 assert result .ret == 0
5044
@@ -57,40 +51,34 @@ def test_skip_config(testdir):
5751 base_url=foo
5852 """ ,
5953 )
60- testdir .makepyfile (
61- """
54+ testdir .makepyfile ("""
6255 import pytest
6356 @pytest.mark.skipif(
6457 "config.getoption('base_url') == 'foo'",
6558 reason='skip')
6659 def test_skip_config(): pass
67- """
68- )
60+ """ )
6961 result = testdir .runpytest ()
7062 assert result .ret == 0
7163
7264
7365def test_env_var_set (testdir , monkeypatch ):
74- testdir .makepyfile (
75- """
66+ testdir .makepyfile ("""
7667 def test_config(request, base_url):
7768 assert request.config.getvalue('base_url')
7869 assert base_url == 'yeehaw'
79- """
80- )
70+ """ )
8171 monkeypatch .setenv ("PYTEST_BASE_URL" , "yeehaw" )
8272 reprec = testdir .inline_run ()
8373 passed , skipped , failed = reprec .listoutcomes ()
8474 assert len (passed ) == 1
8575
8676
8777def test_metadata (testdir , monkeypatch ):
88- testdir .makepyfile (
89- """
78+ testdir .makepyfile ("""
9079 def test_config(metadata):
9180 assert metadata["Base URL"] == 'yeehaw'
92- """
93- )
81+ """ )
9482 monkeypatch .setenv ("PYTEST_BASE_URL" , "yeehaw" )
9583 reprec = testdir .inline_run ()
9684 passed , skipped , failed = reprec .listoutcomes ()
0 commit comments