Skip to content

Commit

Permalink
Added newly introduced compile_pattern method to flavour classes
Browse files Browse the repository at this point in the history
- copied original versions from _PosixFlavour/_WindowsFlavour
  into respective fake classes
- use newest available Python version in Travis builds
- see #508
  • Loading branch information
mrbean-bremen committed Dec 21, 2019
1 parent f7ee177 commit 7a75aee
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
script:
- ./.travis/run_tests.sh
- ./.travis/run_pytest_plugin_test.sh
python: 3.5
python: 3.5.9
env:
- PYTHON=py35
- PY_VERSION=3.5.9
Expand All @@ -45,7 +45,7 @@ jobs:
- ./.travis/run_tests.sh
- ./.travis/run_pytest_fixture_test.sh
- ./.travis/run_pytest_plugin_test.sh
python: 3.6
python: 3.6.9
env:
- PYTHON=py36
- PY_VERSION=3.6.9
Expand All @@ -55,7 +55,7 @@ jobs:
- ./.travis/run_tests.sh
- ./.travis/run_pytest_fixture_test.sh
- ./.travis/run_pytest_plugin_test.sh
python: 3.7
python: 3.7.5
dist: xenial
sudo: true
env:
Expand All @@ -67,12 +67,12 @@ jobs:
- ./.travis/run_tests.sh
- ./.travis/run_pytest_fixture_test.sh
- ./.travis/run_pytest_plugin_test.sh
python: 3.8
python: 3.8.1
dist: xenial
sudo: true
env:
- PYTHON=py38
- PY_VERSION=3.8.0
- PY_VERSION=3.8.1

- stage: test
script:
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
language: generic
env:
- PYTHON=py37
- PY_VERSION=3.7.5
- PY_VERSION=3.7.6

- stage: test
script:
Expand All @@ -131,7 +131,7 @@ jobs:
language: generic
env:
- PYTHON=py38
- PY_VERSION=3.8.0
- PY_VERSION=3.8.1

- stage: test
script:
Expand Down
18 changes: 14 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,31 @@ the proposed changes so you can be ready.
* pyfakefs 4.0 drops support for Python 2.7. If you still need
Python 2.7, you can continue to use the latest pyfakefs 3.x version.

## [Version 3.7.1](https://pypi.python.org/pypi/pyfakefs/3.7.1)

This version adds support for Python 3.7.6 and 3.8.1.

#### Fixes
* Adapted fake `pathlib` to changes in Python 3.7.6/3.8.1
(see [#508](../../issues/508))

## [Version 3.7](https://pypi.python.org/pypi/pyfakefs/3.7)

#### Fixes

This version adds support for Python 3.8.

_Note:_ This is the last pyfakefs version that will support Python 2.7
and Python 3.4 (possible bug fix releases notwithstanding).

### Enhancements
#### Enhancements
* added support for Python 3.8 (see [#504](../../issues/504))
* added preliminary support for Windows-specific `os.stat_result` attributes
`tst_file_attributes` and `st_reparse_tag` (see [#504](../../issues/504))
* added support for fake `os.sendfile` (Posix only, Python 3 only)
(see [#504](../../issues/504))

### Fixes
#### Fixes
* support `devnull` in Windows under Python 3.8
(see [#504](../../issues/504))
* fixed side effect of calling `DirEntry.stat()` under Windows (changed
Expand All @@ -36,13 +46,13 @@ and Python 3.4 (possible bug fix releases notwithstanding).
* raise for `os.scandir` with non-existing directory
(see [#498](../../issues/498))

### Infrastructure
#### Infrastructure
* fixed CI tests scripts to always propagate errors
(see [#500](../../issues/500))

## [Version 3.6.1](https://pypi.python.org/pypi/pyfakefs/3.6.1)

### Fixes
#### Fixes
* avoid rare side effect during module iteration in test setup
(see [#338](../../issues/338))
* make sure real OS tests are not executed by default
Expand Down
9 changes: 8 additions & 1 deletion pyfakefs/fake_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
(including PurePosixPath, PosixPath, PureWindowsPath and WindowsPath)
get the properties of the underlying fake filesystem.
"""

import fnmatch
import os
import re

try:
from urllib.parse import quote_from_bytes as urlquote_from_bytes
Expand Down Expand Up @@ -405,6 +406,9 @@ def gethomedir(self, username):
userhome = self.join(parts)
return userhome

def compile_pattern(self, pattern):
return re.compile(fnmatch.translate(pattern), re.IGNORECASE).fullmatch


class _FakePosixFlavour(_FakeFlavour):
"""Flavour used by PurePosixPath with some Unix specific implementations
Expand Down Expand Up @@ -436,6 +440,9 @@ def gethomedir(self, username):
raise RuntimeError("Can't determine home directory "
"for %r" % username)

def compile_pattern(self, pattern):
return re.compile(fnmatch.translate(pattern)).fullmatch


path_module = pathlib.Path if pathlib else object

Expand Down
3 changes: 2 additions & 1 deletion pyfakefs/tests/fake_pathlib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ def test_glob(self):
[self.path(self.make_path('foo', 'all_tests.py')),
self.path(self.make_path('foo', 'setup.py'))])

@unittest.skipIf(not is_windows, 'Windows specific test')
def test_glob_case_windows(self):
self.check_windows_only()
self.create_file(self.make_path('foo', 'setup.py'))
self.create_file(self.make_path('foo', 'all_tests.PY'))
self.create_file(self.make_path('foo', 'README.md'))
Expand All @@ -723,6 +723,7 @@ def test_glob_case_windows(self):
self.path(self.make_path('foo', 'example.Py')),
self.path(self.make_path('foo', 'setup.py'))])

@unittest.skipIf(is_windows, 'Posix specific test')
def test_glob_case_posix(self):
self.check_posix_only()
self.create_file(self.make_path('foo', 'setup.py'))
Expand Down

0 comments on commit 7a75aee

Please sign in to comment.