Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test on pytest 7 #423

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions requirements/py310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ pyparsing==3.0.6 \
--hash=sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4 \
--hash=sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81
# via packaging
pytest==6.2.5 \
--hash=sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89 \
--hash=sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134
pytest==7.0.0rc1 \
--hash=sha256:8fc363e0b7407a9397e660ef81e1634e4504faaeb6ad1d2416da4c38d29a0f45 \
--hash=sha256:e1af71303d633af3376130b388e028342815cff74d2f3be4aeb22f3fd94325e6
# via
# -r requirements.in
# pytest-forked
Expand All @@ -152,7 +152,7 @@ text-unidecode==1.3 \
--hash=sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8 \
--hash=sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93
# via faker
toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
--hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f
tomli==1.2.2 \
--hash=sha256:c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee \
--hash=sha256:f04066f68f5554911363063a30b108d2b5a5b1a010aa8b6132af78489fe3aade
# via pytest
12 changes: 6 additions & 6 deletions requirements/py36.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ pyparsing==3.0.6 \
--hash=sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4 \
--hash=sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81
# via packaging
pytest==6.2.5 \
--hash=sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89 \
--hash=sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134
pytest==7.0.0rc1 \
--hash=sha256:8fc363e0b7407a9397e660ef81e1634e4504faaeb6ad1d2416da4c38d29a0f45 \
--hash=sha256:e1af71303d633af3376130b388e028342815cff74d2f3be4aeb22f3fd94325e6
# via
# -r requirements.in
# pytest-forked
Expand All @@ -163,9 +163,9 @@ text-unidecode==1.3 \
--hash=sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8 \
--hash=sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93
# via faker
toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
--hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f
tomli==1.2.2 \
--hash=sha256:c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee \
--hash=sha256:f04066f68f5554911363063a30b108d2b5a5b1a010aa8b6132af78489fe3aade
# via pytest
typing-extensions==4.0.1 \
--hash=sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e \
Expand Down
12 changes: 6 additions & 6 deletions requirements/py37.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ pyparsing==3.0.6 \
--hash=sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4 \
--hash=sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81
# via packaging
pytest==6.2.5 \
--hash=sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89 \
--hash=sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134
pytest==7.0.0rc1 \
--hash=sha256:8fc363e0b7407a9397e660ef81e1634e4504faaeb6ad1d2416da4c38d29a0f45 \
--hash=sha256:e1af71303d633af3376130b388e028342815cff74d2f3be4aeb22f3fd94325e6
# via
# -r requirements.in
# pytest-forked
Expand All @@ -159,9 +159,9 @@ text-unidecode==1.3 \
--hash=sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8 \
--hash=sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93
# via faker
toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
--hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f
tomli==1.2.2 \
--hash=sha256:c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee \
--hash=sha256:f04066f68f5554911363063a30b108d2b5a5b1a010aa8b6132af78489fe3aade
# via pytest
typing-extensions==4.0.1 \
--hash=sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e \
Expand Down
12 changes: 6 additions & 6 deletions requirements/py38.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ pyparsing==3.0.6 \
--hash=sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4 \
--hash=sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81
# via packaging
pytest==6.2.5 \
--hash=sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89 \
--hash=sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134
pytest==7.0.0rc1 \
--hash=sha256:8fc363e0b7407a9397e660ef81e1634e4504faaeb6ad1d2416da4c38d29a0f45 \
--hash=sha256:e1af71303d633af3376130b388e028342815cff74d2f3be4aeb22f3fd94325e6
# via
# -r requirements.in
# pytest-forked
Expand All @@ -156,9 +156,9 @@ text-unidecode==1.3 \
--hash=sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8 \
--hash=sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93
# via faker
toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
--hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f
tomli==1.2.2 \
--hash=sha256:c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee \
--hash=sha256:f04066f68f5554911363063a30b108d2b5a5b1a010aa8b6132af78489fe3aade
# via pytest
zipp==3.6.0 \
--hash=sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832 \
Expand Down
12 changes: 6 additions & 6 deletions requirements/py39.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ pyparsing==3.0.6 \
--hash=sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4 \
--hash=sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81
# via packaging
pytest==6.2.5 \
--hash=sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89 \
--hash=sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134
pytest==7.0.0rc1 \
--hash=sha256:8fc363e0b7407a9397e660ef81e1634e4504faaeb6ad1d2416da4c38d29a0f45 \
--hash=sha256:e1af71303d633af3376130b388e028342815cff74d2f3be4aeb22f3fd94325e6
# via
# -r requirements.in
# pytest-forked
Expand All @@ -156,9 +156,9 @@ text-unidecode==1.3 \
--hash=sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8 \
--hash=sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93
# via faker
toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
--hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f
tomli==1.2.2 \
--hash=sha256:c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee \
--hash=sha256:f04066f68f5554911363063a30b108d2b5a5b1a010aa8b6132af78489fe3aade
# via pytest
zipp==3.6.0 \
--hash=sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832 \
Expand Down
21 changes: 14 additions & 7 deletions tests/test_pytest_randomly.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def test_b():
out = ourtestdir.runpytest("-v", "--randomly-seed=1", "--stepwise")
out.assert_outcomes(passed=1, failed=1)
out = ourtestdir.runpytest("-v", "--randomly-seed=1", "--stepwise")
out.assert_outcomes(failed=1)
out.assert_outcomes(failed=1, deselected=1)


def test_fixtures_get_different_random_state_to_tests(ourtestdir):
Expand All @@ -570,13 +570,20 @@ def test_one(myfixture):


def test_fixtures_dont_interfere_with_tests_getting_same_random_state(ourtestdir):
ourtestdir.makepyfile(
conftest="""

def pytest_configure(config):
config.addinivalue_line("markers", "one: test marker one")
config.addinivalue_line("markers", "two: test marker two")
"""
)
ourtestdir.makepyfile(
test_one="""
import random

import pytest


random.seed(2)
state_at_seed_two = random.getstate()

Expand All @@ -586,12 +593,12 @@ def myfixture():
return random.random()


@pytest.mark.one()
@pytest.mark.one
def test_one(myfixture):
assert random.getstate() == state_at_seed_two


@pytest.mark.two()
@pytest.mark.two
def test_two(myfixture):
assert random.getstate() == state_at_seed_two
"""
Expand All @@ -602,9 +609,9 @@ def test_two(myfixture):
out.assert_outcomes(passed=2)

out = ourtestdir.runpytest("-m", "one", *args)
out.assert_outcomes(passed=1)
out.assert_outcomes(passed=1, deselected=1)
out = ourtestdir.runpytest("-m", "two", *args)
out.assert_outcomes(passed=1)
out.assert_outcomes(passed=1, deselected=1)


def test_factory_boy(ourtestdir):
Expand Down Expand Up @@ -704,7 +711,7 @@ def test_failing_import(testdir):
pytest_collection_modifyitems.
"""
modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
assert modcol.instance is None
assert modcol.cls is None

modcol = testdir.getmodulecol("pytest_plugins='xasdlkj',")
with pytest.raises(ImportError):
Expand Down