Skip to content

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
fix indent in tox.ini
fix and extend tests for error
  • Loading branch information
RonnyPfannschmidt committed Feb 26, 2018
1 parent 195595c commit 0f2b1f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
12 changes: 9 additions & 3 deletions testing/root/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import py

import errno
import subprocess


def test_error_classes():
Expand Down Expand Up @@ -33,7 +34,7 @@ def test_unknown_error():
assert cls is cls2


def test_error_conversion_ENOTDIR(testdir):
def test_error_conversion_enotdir(testdir):
p = testdir.makepyfile("")
excinfo = py.test.raises(py.error.Error, py.error.checked_call, p.listdir)
assert isinstance(excinfo.value, EnvironmentError)
Expand All @@ -46,6 +47,11 @@ def test_checked_call_supports_kwargs(tmpdir):
py.error.checked_call(tempfile.mkdtemp, dir=str(tmpdir))


def test_error_importable():
subprocess.check_call(
[sys.executable, '-c', 'from py.error import ENOENT'])


try:
import unittest
unittest.TestCase.assertWarns
Expand All @@ -56,13 +62,13 @@ def test_checked_call_supports_kwargs(tmpdir):
import warnings

class Case(unittest.TestCase):
def test_assertWarns(self):
def test_assert_warns(self):
# Clear everything "py.*" from sys.modules and re-import py
# as a fresh start
for mod in tuple(sys.modules.keys()):
if mod and (mod == 'py' or mod.startswith('py.')):
del sys.modules[mod]
import py
__import__('py')

with self.assertWarns(UserWarning):
warnings.warn('this should work')
11 changes: 5 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ envlist=py{27,34,35,36}-pytest{29,30,31}
[testenv]
changedir=testing
commands=
pip install -U .. # hande the install order fallout since pytest depends on pip

py.test --confcutdir=.. -rfsxX --junitxml={envlogdir}/junit-{envname}.xml []
pip install -U .. # hande the install order fallout since pytest depends on pip
py.test --confcutdir=.. -rfsxX --junitxml={envlogdir}/junit-{envname}.xml []
deps=
attrs
pytest29: pytest~=2.9.0
pytest30: pytest~=3.0.0
pytest31: pytest~=3.1.0
pytest29: pytest~=2.9.0
pytest30: pytest~=3.0.0
pytest31: pytest~=3.1.0

[testenv:py27-xdist]
basepython=python2.7
Expand Down

0 comments on commit 0f2b1f6

Please sign in to comment.