Skip to content

Commit d2d93ad

Browse files
committed
Replace session-scoped with module-scoped fixture in test
- fixes packaging problem if running pytest over all tests - run pytest over all tests in CI docker containers - fixes #1151
1 parent 7085c06 commit d2d93ad

File tree

7 files changed

+16
-8
lines changed

7 files changed

+16
-8
lines changed

.github/workflows/dockerfiles/Dockerfile_debian

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ WORKDIR work/pyfakefs
4242
RUN python3 -m venv ../venv
4343
RUN ../venv/bin/pip install -r requirements.txt
4444
RUN ../venv/bin/pip install -r extra_requirements.txt
45+
RUN ../venv/bin/pip install parquet pyarrow
46+
RUN ../venv/bin/pip install -e .
4547

4648
USER pyfakefs
4749
ENV PYTHONPATH work/pyfakefs
4850
ENV TEST_REAL_FS=1
49-
CMD ["../venv/bin/python", "-m", "pyfakefs.tests.all_tests"]
51+
CMD ["../venv/bin/pytest", "pyfakefs/pytest_tests", "pyfakefs/tests"]

.github/workflows/dockerfiles/Dockerfile_fedora

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ RUN chown -R pyfakefs:pyfakefs work/pyfakefs
3333
WORKDIR work/pyfakefs
3434
RUN pip3 install -r requirements.txt
3535
RUN pip3 install -r extra_requirements.txt
36+
RUN pip3 install -e .
3637

3738
USER pyfakefs
3839
ENV PYTHONPATH work/pyfakefs
3940
ENV TEST_REAL_FS=1
40-
CMD ["python3", "-m", "pyfakefs.tests.all_tests"]
41+
CMD ["pytest", "pyfakefs/pytest_tests", "pyfakefs/tests"]

.github/workflows/dockerfiles/Dockerfile_redhat

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ RUN chown -R pyfakefs:pyfakefs work/pyfakefs
3636
WORKDIR work/pyfakefs
3737
RUN pip3 install -r requirements.txt
3838
RUN pip3 install -r extra_requirements.txt
39+
RUN pip3 install -e .
3940

4041
USER pyfakefs
4142
ENV PYTHONPATH work/pyfakefs
4243
ENV TEST_REAL_FS=1
43-
CMD ["python3", "-m", "pyfakefs.tests.all_tests"]
44+
CMD ["pytest", "pyfakefs/pytest_tests", "pyfakefs/tests"]

.github/workflows/dockerfiles/Dockerfile_ubuntu

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ WORKDIR work/pyfakefs
4242
RUN python3 -m venv ../venv
4343
RUN ../venv/bin/pip install -r requirements.txt
4444
RUN ../venv/bin/pip install -r extra_requirements.txt
45+
RUN ../venv/bin/pip install parquet pyarrow
46+
RUN ../venv/bin/pip install -e .
4547

4648
USER pyfakefs
4749
ENV PYTHONPATH work/pyfakefs
4850
ENV TEST_REAL_FS=1
49-
CMD ["../venv/bin/python", "-m", "pyfakefs.tests.all_tests"]
51+
CMD ["../venv/bin/pytest", "pyfakefs/pytest_tests", "pyfakefs/tests"]

.github/workflows/testsuite.yml

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ jobs:
134134
run: |
135135
echo "$(python -m pytest pyfakefs/pytest_tests/pytest_plugin_failing_helper.py)" > ./testresult.txt
136136
pytest pyfakefs/pytest_tests
137-
pytest pyfakefs/pytest_session_tests
138137
cd pyfakefs/pytest_tests/ns_package
139138
pytest --log-cli-level=INFO test
140139
shell: bash

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ The released versions correspond to PyPI releases.
2020

2121
### Infrastructure
2222
* adapt test for increased default buffer size in Python 3.14a6
23+
* replace session-scoped with module-scoped fixture in test,
24+
run pytest over all tests in docker containers
25+
(see [#1151](../../issues/1151))
2326

2427
## [Version 5.8.0](https://pypi.python.org/pypi/pyfakefs/5.8.0) (2025-03-11)
2528
Adds preliminary support for Python 3.14.

pyfakefs/pytest_session_tests/test_patch_on_setup.py pyfakefs/pytest_tests/test_patch_on_setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ def test_handler_and_check_in_fixture(handler_and_check):
5656
assert Path("/foo/bar").exists()
5757

5858

59-
@pytest.fixture(scope="session", autouse=True)
60-
def config(fs_session: FakeFilesystem):
61-
fs_session.create_file("/foo/bar")
59+
@pytest.fixture(scope="module", autouse=True)
60+
def config(fs_module: FakeFilesystem):
61+
fs_module.create_file("/foo/bar")

0 commit comments

Comments
 (0)