Skip to content

Commit

Permalink
Fix fcache not handling different filesystems on Windows (#55)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Kronopt authored Jun 2, 2020
1 parent abd00af commit 1a88ab6
Show file tree
Hide file tree
Showing 12 changed files with 455 additions and 24 deletions.
26 changes: 13 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ version: 2
jobs:
py27:
docker:
- image: circleci/python:2.7.16
- image: circleci/python:2.7.18
steps:
- checkout
- run:
name: Install Requirements
command: pip install -r requirements.txt -r requirements-dev27.txt --user
- run:
name: Run Tests
command: python -m unittest discover tests
command: make test

py34:
docker:
Expand All @@ -25,49 +25,49 @@ jobs:
command: pip install -r requirements.txt -r requirements-dev27.txt --user
- run:
name: Run Tests
command: python -m unittest
command: make test

py35:
docker:
- image: circleci/python:3.5.7
- image: circleci/python:3.5.8
steps:
- checkout
- run:
name: Install Requirements
command: pip install -r requirements.txt -r requirements-dev27.txt --user
- run:
name: Run Tests
command: python -m unittest
command: make test

py36:
docker:
- image: circleci/python:3.6.9
- image: circleci/python:3.6.10
steps:
- checkout
- run:
name: Install Requirements
command: pip install -r requirements.txt -r requirements-dev27.txt --user
- run:
name: Run Tests
command: python -m unittest
command: make test

py37:
docker:
- image: circleci/python:3.7.4
- image: circleci/python:3.7.7
steps:
- checkout
- run:
name: Install Requirements
command: sudo pip install -r requirements.txt -r requirements-dev.txt
- run:
name: Lint
command: python -m pylint pokepy tests setup.py
command: make lint
- run:
name: Run Tests
command: python -m unittest
command: make test
- run:
name: Run Coverage tool
command: coverage run --source pokepy -m unittest
command: coverage run --source pokepy --omit="pokepy/fcache/*" -m unittest tests.test_pokepy
- run:
name: Generate XML coverage report
command: coverage xml
Expand All @@ -77,15 +77,15 @@ jobs:

py38:
docker:
- image: circleci/python:3.8.0
- image: circleci/python:3.8.3
steps:
- checkout
- run:
name: Install Requirements
command: pip install -r requirements.txt -r requirements-dev27.txt --user
- run:
name: Run Tests
command: python -m unittest
command: make test

workflows:
version: 2
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ clean-docs:
rm -rf site/

lint:
pylint pokepy tests setup.py
python -m pylint --ignore=pokepy/fcache pokepy tests setup.py

test:
python -m unittest tests.test_pokepy
Expand All @@ -46,7 +46,7 @@ test-all:
tox

coverage:
coverage run --source pokepy -m unittest tests.test_pokepy
coverage run --source pokepy --omit="pokepy/fcache/*" -m unittest tests.test_pokepy
coverage report -m
coverage html -d html_coverage
open htmlcov/index.html
Expand Down
3 changes: 3 additions & 0 deletions docs/history.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# History
### 0.6.1 (2020-05-31)
* Fixed disk-based cache not handling different filesystems on Windows

### 0.6.0 (2019-05-3)
* V2Client get methods now return element instead of single element list
* set urllib3 version to >=1.24.3, <1.25 (CVE-2019-11236)
Expand Down
4 changes: 2 additions & 2 deletions make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ rmdir /s /q site
goto:eof

:lint
pylint pokepy tests setup.py
python -m pylint --ignore=pokepy\fcache pokepy tests setup.py
goto:eof

:test
Expand All @@ -61,7 +61,7 @@ tox
goto:eof

:coverage
coverage run --source pokepy -m unittest tests.test_pokepy
coverage run --source pokepy --omit="pokepy\fcache\*" -m unittest tests.test_pokepy
coverage report -m
coverage html -d html_coverage
start "" html_coverage/index.html
Expand Down
2 changes: 1 addition & 1 deletion pokepy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
__author__ = 'Paul Hallett'
__email__ = '[email protected]'
__credits__ = ["Paul Hallett", "Owen Hallett", "Kronopt"]
__version__ = '0.6.0'
__version__ = '0.6.1'
__copyright__ = 'Copyright Paul Hallett 2016'
__license__ = 'BSD'

Expand Down
8 changes: 5 additions & 3 deletions pokepy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import appdirs # dependency of FileCache
from beckett.clients import BaseClient
from beckett.constants import DEFAULT_VALID_STATUS_CODES
from fcache.cache import FileCache
from .fcache.cache import FileCache
from . import resources_v2 as rv2
from . import __version__

Expand Down Expand Up @@ -216,8 +216,10 @@ def memoize(func):
if disk_or_memory == 'disk':
if cache_directory:
# Python 2 and 3.4 workaround
if (sys.version_info[0] == 2 or sys.version_info[0:2] == (3, 4)) and \
not isinstance(cache_directory, str):
if (sys.version_info[0] == 2 and not
isinstance(cache_directory, (str, unicode))) or (
sys.version_info[0:2] == (3, 4) and not
isinstance(cache_directory, str)):
raise TypeError('expected str, not %s' % cache_directory.__class__.__name__)

_global_cache_dir = os.path.join(cache_directory, 'pokepy_cache')
Expand Down
9 changes: 9 additions & 0 deletions pokepy/fcache/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python
# coding: utf-8

"""
fcache
Same codebase as fcache 0.4.7 (https://pypi.org/project/fcache/)
except for a single fix (https://github.com/tsroten/fcache/pull/29)
"""
Loading

0 comments on commit 1a88ab6

Please sign in to comment.