Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: convert to pytest idioms #366

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ source =
[report]
show_missing = true
precision = 2
exclude_also =
def __repr__

if 0:

raise NotImplementedError
1 change: 0 additions & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
strategy:
matrix:
py:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ force_sort_within_sections = true
no_lines_before = "THIRDPARTY"
sections = "FUTURE,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
default_section = "THIRDPARTY"
known_first_party = "colander"
known_first_party = "colander,pytest,translationstring"
force_single_line = true
7 changes: 4 additions & 3 deletions src/colander/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import mimetypes
import pprint
import re
import translationstring
import types
import warnings

import translationstring

_ = translationstring.TranslationStringFactory('colander')


Expand Down Expand Up @@ -199,7 +200,7 @@ def _keyname(self):
return str(self.pos)
return str(self.node.name)

def asdict(self, translate=None, separator='; '):
def asdict(self, translate=None, separator='; '): # pragma NO COVER
"""Return a dict holding a basic error report for this exception.

The values in the dict will **not** be language-translated by
Expand Down Expand Up @@ -231,7 +232,7 @@ def asdict(self, translate=None, separator='; '):
errors['.'.join(keyparts)] = msgs
return errors

def __str__(self):
def __str__(self): # pragma NO COVER
return pprint.pformat(self.asdict())


Expand Down
4 changes: 4 additions & 0 deletions tests/relative.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# For the benefit of TestGlobalObject
class ImportableClass:
pass


def importable_func():
pass
Loading
Loading