Merge pull request #140 from xoviat/patch-1

travis: use tox-travis
This commit is contained in:
Ronny Pfannschmidt
2017-05-17 10:34:15 +02:00
committed by GitHub
4 changed files with 69 additions and 55 deletions

View File

@@ -1,30 +1,19 @@
sudo: false
language: python
python:
- '2.6'
- '2.7'
- '3.4'
- '3.5'
install: pip install -U tox setuptools_scm
env:
matrix:
- '3.6'
install: pip install tox-travis setuptools_scm
matrix:
include:
# note: please use "tox --listenvs" to populate the build matrix
- TOXENV=py26-pytest27
- TOXENV=py26-pytest28
- TOXENV=py26-pytest29
- TOXENV=py26-pytest30
- TOXENV=py27-pytest27
- TOXENV=py27-pytest28
- TOXENV=py27-pytest29
- TOXENV=py27-pytest30
- TOXENV=py34-pytest27
- TOXENV=py34-pytest28
- TOXENV=py34-pytest29
- TOXENV=py34-pytest30
- TOXENV=py35-pytest27
- TOXENV=py35-pytest28
- TOXENV=py35-pytest29
- TOXENV=py27-pytest28-pexpect
- TOXENV=py35-pytest28-pexpect
- TOXENV=flakes
- TOXENV=readme
- python: "3.5"
env: TOXENV=flakes
- python: "3.5"
env: TOXENV=readme
script: tox
notifications:

View File

@@ -16,6 +16,11 @@ environment:
- TOXENV: "py35-pytest27"
- TOXENV: "py35-pytest28"
- TOXENV: "py35-pytest29"
- TOXENV: "py35-pytest30"
- TOXENV: "py36-pytest27"
- TOXENV: "py36-pytest28"
- TOXENV: "py36-pytest29"
- TOXENV: "py36-pytest30"
- TOXENV: "py27-pytest28-pexpect"
- TOXENV: "py35-pytest28-pexpect"
- TOXENV: "flakes"

View File

@@ -10,7 +10,9 @@ class TestDistribution:
""")
result = testdir.runpytest(p1, "-n1")
assert result.ret == 0
result.stdout.fnmatch_lines(["*1 passed*", ])
result.stdout.fnmatch_lines([
"*1 passed*",
])
def test_n1_fail(self, testdir):
p1 = testdir.makepyfile("""
@@ -19,7 +21,9 @@ class TestDistribution:
""")
result = testdir.runpytest(p1, "-n1")
assert result.ret == 1
result.stdout.fnmatch_lines(["*1 failed*", ])
result.stdout.fnmatch_lines([
"*1 failed*",
])
def test_n1_import_error(self, testdir):
p1 = testdir.makepyfile("""
@@ -30,7 +34,7 @@ class TestDistribution:
result = testdir.runpytest(p1, "-n1")
assert result.ret == 1
result.stdout.fnmatch_lines([
"E ImportError: *__import_of_missing_module*",
"E *Error: No module named *__import_of_missing_module*",
])
def test_n2_import_error(self, testdir):
@@ -53,7 +57,9 @@ class TestDistribution:
""")
result = testdir.runpytest(p1, "-n1")
assert result.ret == 0
result.stdout.fnmatch_lines(["*1 skipped*", ])
result.stdout.fnmatch_lines([
"*1 skipped*",
])
def test_manytests_to_one_import_error(self, testdir):
p1 = testdir.makepyfile("""
@@ -64,11 +70,12 @@ class TestDistribution:
result = testdir.runpytest(p1, '--tx=popen', '--tx=popen')
assert result.ret in (1, 2)
result.stdout.fnmatch_lines([
"E ImportError: *__import_of_missing_module*",
"E *Error: No module named *__import_of_missing_module*",
])
def test_manytests_to_one_popen(self, testdir):
p1 = testdir.makepyfile("""
p1 = testdir.makepyfile(
"""
import py
def test_fail0():
assert 0
@@ -108,10 +115,13 @@ class TestDistribution:
""" % str(testdir.tmpdir))
result = testdir.runpytest_subprocess(p1, "-n1")
assert result.ret == 0
result.stdout.fnmatch_lines(["*1 passed*", ])
result.stdout.fnmatch_lines([
"*1 passed*",
])
def test_dist_ini_specified(self, testdir):
p1 = testdir.makepyfile("""
p1 = testdir.makepyfile(
"""
import py
def test_fail0():
assert 0
@@ -207,14 +217,14 @@ class TestDistribution:
""")
p1 = testdir.makepyfile("def test_func(): pass")
result = testdir.runpytest("-v", p1, '-d', '--tx=popen')
result.stdout.fnmatch_lines([
"*0*Python*", "*calculated result is 49*", "*1 passed*"
])
result.stdout.fnmatch_lines(
["*0*Python*", "*calculated result is 49*", "*1 passed*"])
assert result.ret == 0
def test_keyboardinterrupt_hooks_issue79(self, testdir):
testdir.makepyfile(__init__="",
test_one="""
testdir.makepyfile(
__init__="",
test_one="""
def test_hello():
raise KeyboardInterrupt()
""")
@@ -273,8 +283,9 @@ class TestDistEach:
py.test.skip("%s not found" % name)
interpreters.append(interp)
testdir.makepyfile(__init__="",
test_one="""
testdir.makepyfile(
__init__="",
test_one="""
import sys
def test_hello():
print("%s...%s" % sys.version_info[:2])
@@ -335,9 +346,8 @@ def test_teardownfails_one_function(testdir):
assert 0
""")
result = testdir.runpytest(p, '-n1', '--tx=popen')
result.stdout.fnmatch_lines([
"*def teardown_function(function):*", "*1 passed*1 error*"
])
result.stdout.fnmatch_lines(
["*def teardown_function(function):*", "*1 passed*1 error*"])
@py.test.mark.xfail
@@ -350,7 +360,9 @@ def test_terminate_on_hangingnode(testdir):
""")
result = testdir.runpytest(p, '--dist=each', '--tx=popen//id=my')
assert result.duration < 2.0
result.stdout.fnmatch_lines(["*killed*my*", ])
result.stdout.fnmatch_lines([
"*killed*my*",
])
@pytest.mark.xfail(reason="works if run outside test suite", run=False)
@@ -377,7 +389,10 @@ def test_session_hooks(testdir):
assert hasattr(sys, 'pytestsessionhooks')
""")
result = testdir.runpytest(p, "--dist=each", "--tx=popen")
result.stdout.fnmatch_lines(["*ValueError*", "*1 passed*", ])
result.stdout.fnmatch_lines([
"*ValueError*",
"*1 passed*",
])
assert not result.ret
d = result.parseoutcomes()
assert d['passed'] == 1
@@ -422,7 +437,10 @@ def test_funcarg_teardown_failure(testdir):
pass
""")
result = testdir.runpytest_subprocess("--debug", p) # , "-n1")
result.stdout.fnmatch_lines(["*ValueError*42*", "*1 passed*1 error*", ])
result.stdout.fnmatch_lines([
"*ValueError*42*",
"*1 passed*1 error*",
])
assert result.ret
@@ -436,9 +454,8 @@ def test_crashing_item(testdir):
pass
""")
result = testdir.runpytest("-n2", p)
result.stdout.fnmatch_lines([
"*crashed*::test_crash*", "*1 failed*1 passed*"
])
result.stdout.fnmatch_lines(
["*crashed*::test_crash*", "*1 failed*1 passed*"])
def test_crashing_item_teardown(testdir):
@@ -461,9 +478,7 @@ def test_crashing_item_teardown(testdir):
pass
""")
result = testdir.runpytest("-n1", p)
result.stdout.fnmatch_lines([
"*crashed*::test_a*", "*1 failed*2 passed*"
])
result.stdout.fnmatch_lines(["*crashed*::test_a*", "*1 failed*2 passed*"])
def test_skipping(testdir):
@@ -478,7 +493,8 @@ def test_skipping(testdir):
def test_issue34_pluginloading_in_subprocess(testdir):
testdir.tmpdir.join("plugin123.py").write(py.code.Source("""
testdir.tmpdir.join("plugin123.py").write(
py.code.Source("""
def pytest_namespace():
return {'sample_variable': 'testing'}
"""))
@@ -489,7 +505,9 @@ def test_issue34_pluginloading_in_subprocess(testdir):
""")
result = testdir.runpytest_subprocess("-n1", "-p", "plugin123")
assert result.ret == 0
result.stdout.fnmatch_lines(["*1 passed*", ])
result.stdout.fnmatch_lines([
"*1 passed*",
])
def test_fixture_scope_caching_issue503(testdir):
@@ -511,7 +529,9 @@ def test_fixture_scope_caching_issue503(testdir):
""")
result = testdir.runpytest(p1, '-v', '-n1')
assert result.ret == 0
result.stdout.fnmatch_lines(["*2 passed*", ])
result.stdout.fnmatch_lines([
"*2 passed*",
])
def test_issue_594_random_parametrize(testdir):

View File

@@ -1,10 +1,10 @@
[tox]
# if you change the envlist, please update .travis.yml file as well
envlist=
py{26,27,34,35}-pytest{27,28,29,30}
py{26,27,34,35,36}-pytest{27,28,29,30}
py{27,35}-pytest28-pexpect
flakes
readme
readme
[testenv]
@@ -20,7 +20,7 @@ deps =
pytest30: pytest~=3.0.5
pexpect: pexpect
platform=
pexpect: linux|darwin
pexpect: linux|darwin
commands=
# always clean to avoid code unmarshal mismatch on old python/pytest
py.cleanup -aq