Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from davisagli/compat-coverage
test setup, pure python implementation, coverage
- Loading branch information
Showing
8 changed files
with
194 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,11 @@ parts | |
*.pyc | ||
*.pyo | ||
*.so | ||
.coverage | ||
.installed.cfg | ||
.tox | ||
develop-eggs/ | ||
eggs/ | ||
*.egg-info/ | ||
coverage.xml | ||
nosetests.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
language: python | ||
sudo: false | ||
python: | ||
- 2.6 | ||
- 2.7 | ||
- 3.2 | ||
- 3.3 | ||
- 3.4 | ||
- pypy | ||
- pypy3 | ||
install: | ||
- python bootstrap.py | ||
- bin/buildout | ||
- pip install nose | ||
script: | ||
- bin/test -v1 | ||
- nosetests | ||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
include *.txt | ||
|
||
recursive-include include * | ||
recursive-include src * | ||
|
||
global-exclude *.dll | ||
global-exclude *.pyc | ||
global-exclude *.pyo | ||
global-exclude *.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,46 @@ | ||
from _MultiMapping import * | ||
import os | ||
|
||
|
||
class MultiMapping: | ||
__slots__ = ('__dicts__',) | ||
|
||
def __init__(self, *args): | ||
self.__dicts__ = list(args) | ||
|
||
def __getitem__(self, key): | ||
for d in self.__dicts__[::-1]: | ||
try: | ||
return d[key] | ||
except (KeyError, AttributeError): | ||
# XXX How do we get an AttributeError? | ||
pass | ||
raise KeyError(key) | ||
|
||
def get(self, key, default=None): | ||
try: | ||
return self[key] | ||
except KeyError: | ||
return default | ||
|
||
def has_key(self, key): | ||
try: | ||
self[key] | ||
except KeyError: | ||
return False | ||
return True | ||
|
||
def push(self, d): | ||
self.__dicts__.append(d) | ||
|
||
def pop(self, n=-1): | ||
return self.__dicts__.pop(n) | ||
|
||
def __len__(self): | ||
return sum(len(d) for d in self.__dicts__) | ||
|
||
|
||
if 'PURE_PYTHON' not in os.environ: # pragma no cover | ||
try: | ||
from _MultiMapping import * # noqa | ||
except ImportError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[tox] | ||
envlist = | ||
py26,py27,py27-pure,py32,py33,py34,pypy,pypy3,coverage | ||
|
||
[testenv] | ||
commands = | ||
nosetests | ||
deps = | ||
nose | ||
|
||
[testenv:py27-pure] | ||
basepython = | ||
python2.7 | ||
setenv = | ||
PURE_PYTHON = 1 | ||
|
||
[testenv:coverage] | ||
basepython = | ||
python2.7 | ||
commands = | ||
nosetests --with-xunit --with-xcoverage | ||
deps = | ||
nose | ||
coverage | ||
nosexcover | ||
setenv = | ||
PURE_PYTHON = 1 |