1616
1717
1818NATIVE_TOXENV = f"py{ sys .version_info [0 ]} { sys .version_info [1 ]} "
19+ NATIVE_SITE_PACKAGES = f"lib/python{ sys .version_info [0 ]} .{ sys .version_info [1 ]} /site-packages"
1920NATIVE_EXECUTABLE = str (pathlib .Path (sys .executable ).resolve ())
2021FIXTURES_DIR = pathlib .Path (__file__ ).parent / "fixtures"
2122DOT_TOX = pathlib .Path ("./.tox" )
@@ -100,9 +101,9 @@ def is_available(python):
100101 return True
101102
102103
103- needs_py36789 = pytest .mark .skipif (
104- not all ((is_available (f"python3.{ x } " ) for x in range (6 , 10 ))),
105- reason = "This test needs python3.6, 3.7, 3.8 and 3.9 available in $PATH" ,
104+ needs_py3678910 = pytest .mark .skipif (
105+ not all ((is_available (f"python3.{ x } " ) for x in range (6 , 12 ))),
106+ reason = "This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH" ,
106107)
107108
108109
@@ -113,7 +114,7 @@ def test_native_toxenv_current_env():
113114 assert not (DOT_TOX / NATIVE_TOXENV / "lib" ).is_dir ()
114115
115116
116- @needs_py36789
117+ @needs_py3678910
117118def test_all_toxenv_current_env ():
118119 result = tox ("--current-env" , check = False )
119120 assert NATIVE_EXEC_PREFIX_MSG in result .stdout .splitlines ()
@@ -132,7 +133,7 @@ def test_missing_toxenv_current_env(python):
132133 assert result .returncode > 0
133134
134135
135- @needs_py36789
136+ @needs_py3678910
136137def test_all_toxenv_current_env_skip_missing ():
137138 result = tox ("--current-env" , "--skip-missing-interpreters" , check = False )
138139 assert "InterpreterMismatch:" in result .stdout
@@ -255,11 +256,14 @@ def test_allenvs_print_deps(print_deps_stdout_arg):
255256 py
256257 six
257258 py
259+ six
260+ py
258261 ___________________________________ summary ____________________________________
259262 py36: commands succeeded
260263 py37: commands succeeded
261264 py38: commands succeeded
262265 py39: commands succeeded
266+ py310: commands succeeded
263267 congratulations :)
264268 """
265269 ).lstrip ()
@@ -278,18 +282,21 @@ def test_allenvs_print_extras(print_extras_stdout_arg):
278282 full
279283 dev
280284 full
285+ dev
286+ full
281287 ___________________________________ summary ____________________________________
282288 py36: commands succeeded
283289 py37: commands succeeded
284290 py38: commands succeeded
285291 py39: commands succeeded
292+ py310: commands succeeded
286293 congratulations :)
287294 """
288295 ).lstrip ()
289296 assert result .stdout == expected
290297
291298
292- @pytest .mark .parametrize ("toxenv" , ["py36" , "py37" , "py38" , "py39" ])
299+ @pytest .mark .parametrize ("toxenv" , ["py36" , "py37" , "py38" , "py39" , "py310" ])
293300def test_print_deps_to_file (toxenv , tmp_path ):
294301 depspath = tmp_path / "deps"
295302 result = tox ("-e" , toxenv , "--print-deps-to" , str (depspath ))
@@ -304,7 +311,7 @@ def test_print_deps_to_file(toxenv, tmp_path):
304311 assert result .stdout == expected
305312
306313
307- @pytest .mark .parametrize ("toxenv" , ["py36" , "py37" , "py38" , "py39" ])
314+ @pytest .mark .parametrize ("toxenv" , ["py36" , "py37" , "py38" , "py39" , "py310" ])
308315def test_print_extras_to_file (toxenv , tmp_path ):
309316 extraspath = tmp_path / "extras"
310317 result = tox ("-e" , toxenv , "--print-extras-to" , str (extraspath ))
@@ -323,14 +330,15 @@ def test_print_extras_to_file(toxenv, tmp_path):
323330def test_allenvs_print_deps_to_file (tmp_path , option ):
324331 depspath = tmp_path / "deps"
325332 result = tox (option , str (depspath ))
326- assert depspath .read_text ().splitlines () == ["six" , "py" ] * 4
333+ assert depspath .read_text ().splitlines () == ["six" , "py" ] * 5
327334 expected = textwrap .dedent (
328335 """
329336 ___________________________________ summary ____________________________________
330337 py36: commands succeeded
331338 py37: commands succeeded
332339 py38: commands succeeded
333340 py39: commands succeeded
341+ py310: commands succeeded
334342 congratulations :)
335343 """
336344 ).lstrip ()
@@ -341,14 +349,15 @@ def test_allenvs_print_deps_to_file(tmp_path, option):
341349def test_allenvs_print_extras_to_file (tmp_path , option ):
342350 extraspath = tmp_path / "extras"
343351 result = tox (option , str (extraspath ))
344- assert extraspath .read_text ().splitlines () == ["dev" , "full" ] * 4
352+ assert extraspath .read_text ().splitlines () == ["dev" , "full" ] * 5
345353 expected = textwrap .dedent (
346354 """
347355 ___________________________________ summary ____________________________________
348356 py36: commands succeeded
349357 py37: commands succeeded
350358 py38: commands succeeded
351359 py39: commands succeeded
360+ py310: commands succeeded
352361 congratulations :)
353362 """
354363 ).lstrip ()
@@ -447,16 +456,17 @@ def test_print_deps_only_print_deps_to_file_are_mutually_exclusive():
447456 assert "cannot be used together" in result .stderr
448457
449458
450- @needs_py36789
459+ @needs_py3678910
451460def test_regular_run ():
452461 result = tox ()
453- lines = sorted ( result .stdout .splitlines ()[:4 ])
462+ lines = result .stdout .splitlines ()[:5 ]
454463 assert "/.tox/py36 is the exec_prefix" in lines [0 ]
455464 assert "/.tox/py37 is the exec_prefix" in lines [1 ]
456465 assert "/.tox/py38 is the exec_prefix" in lines [2 ]
457466 assert "/.tox/py39 is the exec_prefix" in lines [3 ]
467+ assert "/.tox/py310 is the exec_prefix" in lines [4 ]
458468 assert "congratulations" in result .stdout
459- for y in 6 , 7 , 8 , 9 :
469+ for y in 6 , 7 , 8 , 9 , 10 :
460470 for pkg in "py" , "six" , "test" :
461471 sitelib = DOT_TOX / f"py3{ y } /lib/python3.{ y } /site-packages"
462472 assert sitelib .is_dir ()
@@ -470,7 +480,7 @@ def test_regular_run_native_toxenv():
470480 assert "congratulations" in result .stdout
471481 for pkg in "py" , "six" , "test" :
472482 sitelib = (
473- DOT_TOX / f"{ NATIVE_TOXENV } /lib/python3. { NATIVE_TOXENV [ - 1 ] } /site-packages "
483+ DOT_TOX / f"{ NATIVE_TOXENV } /{ NATIVE_SITE_PACKAGES } "
474484 )
475485 assert sitelib .is_dir ()
476486 assert len (list (sitelib .glob (f"{ pkg } -*.dist-info" ))) == 1
@@ -565,7 +575,7 @@ def test_regular_recreate_after_print_deps(print_deps_stdout_arg):
565575
566576 result = tox ("-re" , NATIVE_TOXENV )
567577 assert result .stdout .splitlines ()[0 ] != NATIVE_EXEC_PREFIX_MSG
568- sitelib = DOT_TOX / f"{ NATIVE_TOXENV } /lib/python3. { NATIVE_TOXENV [ - 1 ] } /site-packages "
578+ sitelib = DOT_TOX / f"{ NATIVE_TOXENV } /{ NATIVE_SITE_PACKAGES } "
569579 assert sitelib .is_dir ()
570580 assert len (list (sitelib .glob ("test-*.dist-info" ))) == 1
571581
0 commit comments