@@ -172,7 +172,7 @@ def test_config_parse_platform_rex(self, newconfig, mocksession, monkeypatch):
172
172
monkeypatch .undo ()
173
173
assert not venv .matching_platform ()
174
174
175
- @pytest .mark .parametrize ("plat" , ["win" , "lin" , ])
175
+ @pytest .mark .parametrize ("plat" , ["win" , "lin" , "osx" ])
176
176
def test_config_parse_platform_with_factors (self , newconfig , plat , monkeypatch ):
177
177
monkeypatch .setattr (sys , "platform" , "win32" )
178
178
config = newconfig ([], """
@@ -185,7 +185,7 @@ def test_config_parse_platform_with_factors(self, newconfig, plat, monkeypatch):
185
185
""" )
186
186
assert len (config .envconfigs ) == 3
187
187
platform = config .envconfigs ['py27-' + plat ].platform
188
- expected = {"win" : "win32" , "lin" : "linux2" }.get (plat )
188
+ expected = {"win" : "win32" , "lin" : "linux2" , "osx" : "" }.get (plat )
189
189
assert platform == expected
190
190
191
191
@@ -526,8 +526,6 @@ def test_argvlist(self, tmpdir, newconfig):
526
526
""" )
527
527
reader = SectionReader ("section" , config ._cfg )
528
528
reader .addsubstitutions (item1 = "with space" , item2 = "grr" )
529
- # pytest.raises(tox.exception.ConfigError,
530
- # "reader.getargvlist('key1')")
531
529
assert reader .getargvlist ('key1' ) == []
532
530
x = reader .getargvlist ("key2" )
533
531
assert x == [["cmd1" , "with" , "space" , "grr" ],
@@ -552,8 +550,6 @@ def test_argvlist_multiline(self, tmpdir, newconfig):
552
550
""" )
553
551
reader = SectionReader ("section" , config ._cfg )
554
552
reader .addsubstitutions (item1 = "with space" , item2 = "grr" )
555
- # pytest.raises(tox.exception.ConfigError,
556
- # "reader.getargvlist('key1')")
557
553
assert reader .getargvlist ('key1' ) == []
558
554
x = reader .getargvlist ("key2" )
559
555
assert x == [["cmd1" , "with" , "space" , "grr" ]]
@@ -600,17 +596,13 @@ def test_argvlist_positional_substitution(self, tmpdir, newconfig):
600
596
reader = SectionReader ("section" , config ._cfg )
601
597
posargs = ['hello' , 'world' ]
602
598
reader .addsubstitutions (posargs , item2 = "value2" )
603
- # pytest.raises(tox.exception.ConfigError,
604
- # "reader.getargvlist('key1')")
605
599
assert reader .getargvlist ('key1' ) == []
606
600
argvlist = reader .getargvlist ("key2" )
607
601
assert argvlist [0 ] == ["cmd1" ] + posargs
608
602
assert argvlist [1 ] == ["cmd2" ] + posargs
609
603
610
604
reader = SectionReader ("section" , config ._cfg )
611
605
reader .addsubstitutions ([], item2 = "value2" )
612
- # pytest.raises(tox.exception.ConfigError,
613
- # "reader.getargvlist('key1')")
614
606
assert reader .getargvlist ('key1' ) == []
615
607
argvlist = reader .getargvlist ("key2" )
616
608
assert argvlist [0 ] == ["cmd1" ]
@@ -1411,6 +1403,33 @@ def get_deps(env):
1411
1403
assert get_deps ("b-x" ) == ["dep-a-or-b" ]
1412
1404
assert get_deps ("b-y" ) == ["dep-a-or-b" , "dep-ab-and-y" ]
1413
1405
1406
+ def test_envconfigs_based_on_factors (self , newconfig ):
1407
+ inisource = """
1408
+ [testenv]
1409
+ some-setting=
1410
+ a: something
1411
+ b,c: something
1412
+ d-e: something
1413
+
1414
+ [unknown-section]
1415
+ some-setting=
1416
+ eggs: something
1417
+ """
1418
+ config = newconfig (["-e spam" ], inisource )
1419
+ assert not config .envconfigs
1420
+ assert config .envlist == ["spam" ]
1421
+ config = newconfig (["-e eggs" ], inisource )
1422
+ assert not config .envconfigs
1423
+ assert config .envlist == ["eggs" ]
1424
+ config = newconfig (["-e py3-spam" ], inisource )
1425
+ assert not config .envconfigs
1426
+ assert config .envlist == ["py3-spam" ]
1427
+ for x in "abcde" :
1428
+ env = "py3-{}" .format (x )
1429
+ config = newconfig (["-e {}" .format (env )], inisource )
1430
+ assert sorted (config .envconfigs ) == [env ]
1431
+ assert config .envlist == [env ]
1432
+
1414
1433
def test_default_factors (self , newconfig ):
1415
1434
inisource = """
1416
1435
[tox]
@@ -1576,6 +1595,8 @@ def test_env_selection(self, tmpdir, newconfig, monkeypatch):
1576
1595
assert config .envlist == ['py27' , 'py35' , 'py36' ]
1577
1596
config = newconfig (["-eALL" ], inisource )
1578
1597
assert config .envlist == ['py27' , 'py35' , 'py36' ]
1598
+ config = newconfig (['-espam' ], inisource )
1599
+ assert config .envlist == ["spam" ]
1579
1600
1580
1601
def test_py_venv (self , tmpdir , newconfig , monkeypatch ):
1581
1602
config = newconfig (["-epy" ], "" )
@@ -2308,7 +2329,6 @@ class TestCommandParser:
2308
2329
2309
2330
def test_command_parser_for_word (self ):
2310
2331
p = CommandParser ('word' )
2311
- # import pytest; pytest.set_trace()
2312
2332
assert list (p .words ()) == ['word' ]
2313
2333
2314
2334
def test_command_parser_for_posargs (self ):
0 commit comments