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

Python 3.7 tests are broken #508

Closed
jonringer opened this issue Dec 21, 2019 · 3 comments
Closed

Python 3.7 tests are broken #508

jonringer opened this issue Dec 21, 2019 · 3 comments

Comments

@jonringer
Copy link

Describe the bug
Packaging this for nixpkgs, and noticed the python3.7 test suite is broken with the following error:

Error log
======================================================================
ERROR: test_glob (pyfakefs.tests.fake_pathlib_test.FakePathlibPathFileOperationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pyfakefs-3.7/pyfakefs/tests/fake_pathlib_test.py", line 710, in test_glob
    self.assertEqual(sorted(path.glob('*.py')),
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 1119, in glob
    selector = _make_selector(tuple(pattern_parts), self._flavour)
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 464, in _make_selector
    return cls(pat, child_parts, flavour)
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 520, in __init__
    self.match = flavour.compile_pattern(pat)
AttributeError: '_FakePosixFlavour' object has no attribute 'compile_pattern'

======================================================================
ERROR: test_glob_case_posix (pyfakefs.tests.fake_pathlib_test.FakePathlibPathFileOperationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pyfakefs-3.7/pyfakefs/tests/fake_pathlib_test.py", line 733, in test_glob_case_posix
    self.assertEqual(sorted(path.glob('*.py')),
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 1119, in glob
    selector = _make_selector(tuple(pattern_parts), self._flavour)
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 464, in _make_selector
    return cls(pat, child_parts, flavour)
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 520, in __init__
    self.match = flavour.compile_pattern(pat)
AttributeError: '_FakePosixFlavour' object has no attribute 'compile_pattern'

======================================================================
ERROR: test_glob_case_windows (pyfakefs.tests.fake_pathlib_test.FakePathlibPathFileOperationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/pyfakefs-3.7/pyfakefs/tests/fake_pathlib_test.py", line 721, in test_glob_case_windows
    self.assertEqual(sorted(path.glob('*.py')),
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 1119, in glob
    selector = _make_selector(tuple(pattern_parts), self._flavour)
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 464, in _make_selector
    return cls(pat, child_parts, flavour)
  File "/nix/store/v543lrn8xkx5ylsa6g59l8s74jx3nh6p-python3-3.7.6/lib/python3.7/pathlib.py", line 520, in __init__
    self.match = flavour.compile_pattern(pat)
AttributeError: '_FakePosixFlavour' object has no attribute 'compile_pattern'

----------------------------------------------------------------------
Ran 1901 tests in 4.445s

FAILED (errors=3, skipped=745, expected failures=2)

It's also only failing on 3.7. 2.7,3.5,3.6,3.8 all seem to pass fine.

How To Reproduce

python3.7 -m pyfakefs.tests.all_tests

Your enviroment
Please run the following and paste the output.

$ nix run nixpkgs.nix-info -c nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.3, NixOS, 20.03pre205780.d942688fc13 (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.1`
 - channels(jon): `"home-manager, nixos-20.03pre203904.bb1013511e1"`
 - channels(root): `"nixos-20.03pre205780.d942688fc13"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

pyfakefs 3.7

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Dec 21, 2019

Thanks! We didn't notice this due to an older Python 3.7 version used in the Travis tests.
I can confirm that this is reproducible both with Python 3.7.6 and Python 3.8.1, but didn't happen with the previous versions (3.7.5 and 3.8.0). Looks like the pathlib implementation has changed in these versions (which have been released after pyfakefs 3.7...).
I will try to understand that and get a fix together. I will probably make a dot release after this has been fixed.

mrbean-bremen added a commit that referenced this issue Dec 21, 2019
- copied original versions from _PosixFlavour/_WindowsFlavour
  into respective fake classes
- use newest available Python version in Travis builds
- see #508
mrbean-bremen added a commit that referenced this issue Dec 21, 2019
- copied original versions from _PosixFlavour/_WindowsFlavour
  into respective fake classes
- use newest available Python version in Travis builds
- see #508
@mrbean-bremen
Copy link
Member

For reference - this has been introduced in pathlib in this commit.

@mrbean-bremen
Copy link
Member

Fixed in master and 3.7.1 branch, added new 3.7.1 PyPi release.
Closing. Please reopen if you still have problems with 3.7.1.

mrbean-bremen added a commit that referenced this issue Jan 1, 2020
- copied original versions from _PosixFlavour/_WindowsFlavour
  into respective fake classes
- use newest available Python version in Travis builds
- see #508
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants