Skip to content
Permalink
Browse files

Changes to correctly run setup.py test under Python 2

- exclude pathlib tests if pathlib is not available
- moved pytest tests put of tests to not be discovered
- see #465
  • Loading branch information...
mrbean-bremen committed Feb 16, 2019
1 parent b9b5623 commit 4b4e59407ecfa09cecea116f64ba6e0a5e9d0343
@@ -5,10 +5,10 @@ if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
fi

if ! [[ $VM == 'Docker' ]]; then
python -m pytest pyfakefs/tests/pytest/pytest_plugin_test.py
python -m pytest pyfakefs/pytest_tests/pytest_plugin_test.py
if [[ $PYTHON == 'py36' ]] || [[ $PYTHON == 'py37' ]]; then
python -m pytest pyfakefs/tests/pytest/pytest_fixture_test.py
python -m pytest pyfakefs/pytest_tests/pytest_fixture_test.py
fi
python -m pytest pyfakefs/tests/pytest/pytest_plugin_failing_test.py > ./testresult.txt
python -m pytest pyfakefs/tests/pytest/pytest_check_failed_plugin_test.py
python -m pytest pyfakefs/pytest_tests/pytest_plugin_failing_test.py > ./testresult.txt
python -m pytest pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py
fi
@@ -78,7 +78,7 @@ $ export PYTHONPATH=$PWD
$ python -m pyfakefs.tests.all_tests
$ python -m pyfakefs.tests.all_tests_without_extra_packages
$ python -m pytest pyfakefs/tests/pytest/pytest_plugin_test.py
$ python -m pytest pyfakefs/pytest_tests/pytest_plugin_test.py
```

These scripts are called by `tox` and Travis-CI. `tox` can be used to run tests
@@ -18,7 +18,7 @@ test_script:
- SET TEST_REAL_FS=1
- "%PYTHON%\\python.exe -m pyfakefs.tests.all_tests"
- "%PYTHON%\\python.exe -m pyfakefs.tests.all_tests_without_extra_packages"
- "%PYTHON%\\python.exe -m pytest pyfakefs\\tests\\pytest\\pytest_plugin_test.py"
- IF "C:\\Python36-x64"=="%PYTHON%" "%PYTHON%\\python.exe -m pytest pyfakefs\\tests\\pytest\\pytest_fixture_test.py"
- "%PYTHON%\\python.exe -m pytest pyfakefs\\tests\\pytest\\pytest_plugin_failing_test.py > testresult.txt | echo."
- "%PYTHON%\\python.exe -m pytest pyfakefs\\tests\\pytest\\pytest_check_failed_plugin_test.py"
- "%PYTHON%\\python.exe -m pytest pyfakefs\\pytest_tests\\pytest_plugin_test.py"
- IF "C:\\Python36-x64"=="%PYTHON%" "%PYTHON%\\python.exe -m pytest pyfakefs\\pytest_tests\\pytest_fixture_test.py"
- "%PYTHON%\\python.exe -m pytest pyfakefs\\pytest_tests\\pytest_plugin_failing_test.py > testresult.txt | echo."
- "%PYTHON%\\python.exe -m pytest pyfakefs\\pytest_tests\\pytest_check_failed_plugin_test.py"
@@ -101,8 +101,8 @@ be set in the TestCase instance initialization, or passed to ``setUpPyfakefs()``
you can add your own fixture with the needed parameters.

An example for both approaches can be found in
`pytest_fixture_test.py <https://github.com/jmcgeheeiv/pyfakefs/blob/master/pyfakefs/tests/pytest/pytest_fixture_test.py>`__
with the example fixture in `conftest.py <https://github.com/jmcgeheeiv/pyfakefs/blob/master/pyfakefs/tests/pytest/conftest.py>`__.
`pytest_fixture_test.py <https://github.com/jmcgeheeiv/pyfakefs/blob/master/pyfakefs/pytest_tests/pytest_fixture_test.py>`__
with the example fixture in `conftest.py <https://github.com/jmcgeheeiv/pyfakefs/blob/master/pyfakefs/pytest_tests/conftest.py>`__.
We advice to use this example fixture code as a template for your customized
pytest plugins.

File renamed without changes.
@@ -29,7 +29,7 @@
Patcher.SKIPMODULES.add(tokenize)

from pyfakefs.fake_filesystem_unittest import Patcher
from pyfakefs.tests.pytest import example
from pyfakefs.pytest_tests import example


@pytest.fixture
File renamed without changes.
@@ -15,7 +15,7 @@

import pytest

import pyfakefs.tests.pytest.example as example
import pyfakefs.pytest_tests.example as example
from pyfakefs.fake_filesystem_unittest import Patcher


File renamed without changes.
Oops, something went wrong.

0 comments on commit 4b4e594

Please sign in to comment.
You can’t perform that action at this time.