Skip to content

Commit 1a88ab6

Browse files
authored
Fix fcache not handling different filesystems on Windows (#55)
fix #54 - bumped pokepy version to 0.6.1 - add appdirs to requirements.txt - bumped python versions in circleci config - ignore fcache files on coverage and linting - fix a py27-specific error
1 parent abd00af commit 1a88ab6

12 files changed

Lines changed: 455 additions & 24 deletions

File tree

.circleci/config.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ version: 2
55
jobs:
66
py27:
77
docker:
8-
- image: circleci/python:2.7.16
8+
- image: circleci/python:2.7.18
99
steps:
1010
- checkout
1111
- run:
1212
name: Install Requirements
1313
command: pip install -r requirements.txt -r requirements-dev27.txt --user
1414
- run:
1515
name: Run Tests
16-
command: python -m unittest discover tests
16+
command: make test
1717

1818
py34:
1919
docker:
@@ -25,49 +25,49 @@ jobs:
2525
command: pip install -r requirements.txt -r requirements-dev27.txt --user
2626
- run:
2727
name: Run Tests
28-
command: python -m unittest
28+
command: make test
2929

3030
py35:
3131
docker:
32-
- image: circleci/python:3.5.7
32+
- image: circleci/python:3.5.8
3333
steps:
3434
- checkout
3535
- run:
3636
name: Install Requirements
3737
command: pip install -r requirements.txt -r requirements-dev27.txt --user
3838
- run:
3939
name: Run Tests
40-
command: python -m unittest
40+
command: make test
4141

4242
py36:
4343
docker:
44-
- image: circleci/python:3.6.9
44+
- image: circleci/python:3.6.10
4545
steps:
4646
- checkout
4747
- run:
4848
name: Install Requirements
4949
command: pip install -r requirements.txt -r requirements-dev27.txt --user
5050
- run:
5151
name: Run Tests
52-
command: python -m unittest
52+
command: make test
5353

5454
py37:
5555
docker:
56-
- image: circleci/python:3.7.4
56+
- image: circleci/python:3.7.7
5757
steps:
5858
- checkout
5959
- run:
6060
name: Install Requirements
6161
command: sudo pip install -r requirements.txt -r requirements-dev.txt
6262
- run:
6363
name: Lint
64-
command: python -m pylint pokepy tests setup.py
64+
command: make lint
6565
- run:
6666
name: Run Tests
67-
command: python -m unittest
67+
command: make test
6868
- run:
6969
name: Run Coverage tool
70-
command: coverage run --source pokepy -m unittest
70+
command: coverage run --source pokepy --omit="pokepy/fcache/*" -m unittest tests.test_pokepy
7171
- run:
7272
name: Generate XML coverage report
7373
command: coverage xml
@@ -77,15 +77,15 @@ jobs:
7777

7878
py38:
7979
docker:
80-
- image: circleci/python:3.8.0
80+
- image: circleci/python:3.8.3
8181
steps:
8282
- checkout
8383
- run:
8484
name: Install Requirements
8585
command: pip install -r requirements.txt -r requirements-dev27.txt --user
8686
- run:
8787
name: Run Tests
88-
command: python -m unittest
88+
command: make test
8989

9090
workflows:
9191
version: 2

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ clean-docs:
3737
rm -rf site/
3838

3939
lint:
40-
pylint pokepy tests setup.py
40+
python -m pylint --ignore=pokepy/fcache pokepy tests setup.py
4141

4242
test:
4343
python -m unittest tests.test_pokepy
@@ -46,7 +46,7 @@ test-all:
4646
tox
4747

4848
coverage:
49-
coverage run --source pokepy -m unittest tests.test_pokepy
49+
coverage run --source pokepy --omit="pokepy/fcache/*" -m unittest tests.test_pokepy
5050
coverage report -m
5151
coverage html -d html_coverage
5252
open htmlcov/index.html

docs/history.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# History
2+
### 0.6.1 (2020-05-31)
3+
* Fixed disk-based cache not handling different filesystems on Windows
4+
25
### 0.6.0 (2019-05-3)
36
* V2Client get methods now return element instead of single element list
47
* set urllib3 version to >=1.24.3, <1.25 (CVE-2019-11236)

make.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ rmdir /s /q site
4949
goto:eof
5050

5151
:lint
52-
pylint pokepy tests setup.py
52+
python -m pylint --ignore=pokepy\fcache pokepy tests setup.py
5353
goto:eof
5454

5555
:test
@@ -61,7 +61,7 @@ tox
6161
goto:eof
6262

6363
:coverage
64-
coverage run --source pokepy -m unittest tests.test_pokepy
64+
coverage run --source pokepy --omit="pokepy\fcache\*" -m unittest tests.test_pokepy
6565
coverage report -m
6666
coverage html -d html_coverage
6767
start "" html_coverage/index.html

pokepy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
__author__ = 'Paul Hallett'
1717
__email__ = 'hello@phalt.co'
1818
__credits__ = ["Paul Hallett", "Owen Hallett", "Kronopt"]
19-
__version__ = '0.6.0'
19+
__version__ = '0.6.1'
2020
__copyright__ = 'Copyright Paul Hallett 2016'
2121
__license__ = 'BSD'
2222

pokepy/api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import appdirs # dependency of FileCache
1616
from beckett.clients import BaseClient
1717
from beckett.constants import DEFAULT_VALID_STATUS_CODES
18-
from fcache.cache import FileCache
18+
from .fcache.cache import FileCache
1919
from . import resources_v2 as rv2
2020
from . import __version__
2121

@@ -216,8 +216,10 @@ def memoize(func):
216216
if disk_or_memory == 'disk':
217217
if cache_directory:
218218
# Python 2 and 3.4 workaround
219-
if (sys.version_info[0] == 2 or sys.version_info[0:2] == (3, 4)) and \
220-
not isinstance(cache_directory, str):
219+
if (sys.version_info[0] == 2 and not
220+
isinstance(cache_directory, (str, unicode))) or (
221+
sys.version_info[0:2] == (3, 4) and not
222+
isinstance(cache_directory, str)):
221223
raise TypeError('expected str, not %s' % cache_directory.__class__.__name__)
222224

223225
_global_cache_dir = os.path.join(cache_directory, 'pokepy_cache')

pokepy/fcache/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
4+
"""
5+
fcache
6+
7+
Same codebase as fcache 0.4.7 (https://pypi.org/project/fcache/)
8+
except for a single fix (https://github.com/tsroten/fcache/pull/29)
9+
"""

0 commit comments

Comments
 (0)