Skip to content

Commit

Permalink
Merge pull request #91 from asottile/fspath
Browse files Browse the repository at this point in the history
Add support for __fspath__ (py36)
  • Loading branch information
dnephin committed Feb 15, 2017
2 parents fce09a5 + 8a7f23a commit c3e3c5c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
26 changes: 14 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
language: python
env:
- TOX_ENV=py26
- TOX_ENV=py27
- TOX_ENV=py33
- TOX_ENV=py34
- TOX_ENV=pypy
- TOX_ENV=docs
- TOX_ENV=coverage

install:
- pip install tox coveralls
script: tox -e $TOX_ENV
matrix:
include:
- env: TOXENV=py26
- env: TOXENV=py27
- env: TOXENV=py34
- env: TOXENV=py35
python: 3.5
- env: TOXENV=py36
python: 3.6
- env: TOXENV=pypy
- env: TOXENV=docs
- env: TOXENV=coverage
install: pip install tox coveralls
script: tox
after_success: coveralls
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Operating System :: OS Independent",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
Expand Down
7 changes: 6 additions & 1 deletion staticconf/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,18 @@ def __repr__(self):
'__rmul__', '__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__',
'__rtruediv__', '__rxor__', '__setitem__', '__setslice__', '__sub__',
'__truediv__', '__xor__', 'next', '__nonzero__', '__str__', '__unicode__',
'__index__',
'__index__', '__fspath__',
]


def identity(x):
return x


unary_funcs = {
'__unicode__': six.text_type,
'__str__': str,
'__fspath__': identity, # python3.6+ os.PathLike interface
'__repr__': repr,
'__nonzero__': bool, # Python2 bool
'__bool__': bool, # Python3 bool
Expand Down
2 changes: 2 additions & 0 deletions tests/proxy_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import os.path

import pytest

Expand Down Expand Up @@ -79,6 +80,7 @@ def test_proxy_with_string(self):
assert_equal(value_proxy, 'one%s')
assert value_proxy < 'two'
assert value_proxy > 'ab'
assert os.path.join(value_proxy, 'a') == os.path.join('one%s', 'a')
assert_equal(value_proxy + '!', 'one%s!')
assert_equal(value_proxy % '!', 'one!')
assert_equal(repr(value_proxy), "'one%s'")
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py26,py27,py34,py35,pypy,docs,coverage
envlist = py26,py27,py34,py35,py36,pypy,docs,coverage

[testenv]
deps =
Expand Down

0 comments on commit c3e3c5c

Please sign in to comment.