Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9311878
D6511.id23675.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D6511.id23675.diff
View Options
diff --git a/pytest.ini b/pytest.ini
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,11 +1,9 @@
[pytest]
-addopts = -p no:flask -p no:pytest_swh_storage --ignore-glob=*random_fixtures_test.py
+addopts = -p no:flask -p no:pytest_swh_storage --ignore=swh/web/tests/random_fixtures_test.py
norecursedirs = docs node_modules .tox
DJANGO_SETTINGS_MODULE = swh.web.settings.tests
filterwarnings =
ignore:.*Plural value must be an integer, got float
ignore:.*Using or importing the ABCs from 'collections'
- ignore:.*uses the 'client' fixture
- ignore:.*uses the 'mocker' fixture
- ignore:.*uses the 'requests_mock' fixture
+ ignore:.*uses the.*fixture, which is reset between function calls
ignore:.*'U' mode is deprecated
diff --git a/swh/web/tests/conftest.py b/swh/web/tests/conftest.py
--- a/swh/web/tests/conftest.py
+++ b/swh/web/tests/conftest.py
@@ -159,7 +159,7 @@
random.setstate(state)
-def pytest_report_teststatus(report, config):
+def pytest_report_teststatus(report, *args):
if report.when == "call" and report.outcome == "failed":
seed = cache.get(_random_seed_cache_key, None)
line = (
@@ -169,7 +169,7 @@
report.sections.append((_swh_web_custom_section, line))
-def pytest_terminal_summary(terminalreporter, exitstatus, config):
+def pytest_terminal_summary(terminalreporter, *args):
reports = terminalreporter.getreports("failed")
content = os.linesep.join(
text
diff --git a/swh/web/tests/test_random_fixtures.py b/swh/web/tests/test_random_fixtures.py
--- a/swh/web/tests/test_random_fixtures.py
+++ b/swh/web/tests/test_random_fixtures.py
@@ -6,18 +6,20 @@
import os
import subprocess
+pytest_command = ["python3", "-m", "pytest", "-s"]
+
def test_random_fixtures():
"""Check random fixture values will be different when random seed
is not explicitly provided.
"""
result_first = subprocess.run(
- ["pytest", "-s", "random_fixtures_test.py"],
+ [*pytest_command, "random_fixtures_test.py"],
capture_output=True,
cwd=os.path.dirname(__file__),
)
result_second = subprocess.run(
- ["pytest", "-s", "random_fixtures_test.py"],
+ [*pytest_command, "random_fixtures_test.py"],
capture_output=True,
cwd=os.path.dirname(__file__),
)
@@ -30,12 +32,12 @@
is explicitly provided through a custom pytest option.
"""
result_first = subprocess.run(
- ["pytest", "-s", "--swh-web-random-seed=2021", "random_fixtures_test.py"],
+ [*pytest_command, "--swh-web-random-seed=2021", "random_fixtures_test.py"],
capture_output=True,
cwd=os.path.dirname(__file__),
)
result_second = subprocess.run(
- ["pytest", "-s", "--swh-web-random-seed=2021", "random_fixtures_test.py"],
+ [*pytest_command, "--swh-web-random-seed=2021", "random_fixtures_test.py"],
capture_output=True,
cwd=os.path.dirname(__file__),
)
diff --git a/tox.ini b/tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -10,6 +10,7 @@
pytest \
slow: --hypothesis-profile=swh-web \
!slow: --hypothesis-profile=swh-web-fast \
+ --ignore-glob=*random_fixtures_test.py \
--cov {envsitepackagesdir}/swh/web --cov-branch {posargs} {envsitepackagesdir}/swh/web
[testenv:flake8]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 2, 10:35 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221087
Attached To
D6511: tests: Fix execution when building debian packages
Event Timeline
Log In to Comment