From df4e4dbdae3cba3cd096787846f2b54111f9de28 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 11 Jul 2013 11:36:21 -0400 Subject: Add test to use usedevelop While we're at it, fix the error that adding the test found. --- tests/test_z_cmdline.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ tox/_venv.py | 4 ++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 12628e3..b45cab4 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -359,6 +359,59 @@ def test_test_simple(cmd, initproj): ]) +def test_test_develop(cmd, initproj): + initproj("example123-0.5", filedefs={ + 'tests': {'test_hello.py': """ + def test_hello(pytestconfig): + pass + """, + }, + 'tox.ini': ''' + [tox] + usedevelop=True + [testenv] + changedir=tests + commands= + py.test --basetemp={envtmpdir} --junitxml=junit-{envname}.xml [] + deps=pytest + ''' + }) + result = cmd.run("tox") + assert not result.ret + result.stdout.fnmatch_lines([ + "*junit-python.xml*", + "*1 passed*", + ]) + result = cmd.run("tox", "-epython", ) + assert not result.ret + result.stdout.fnmatch_lines([ + "*1 passed*", + "*summary*", + "*python: commands succeeded" + ]) + # see that things work with a different CWD + old = cmd.tmpdir.chdir() + result = cmd.run("tox", "-c", "example123/tox.ini") + assert not result.ret + result.stdout.fnmatch_lines([ + "*1 passed*", + "*summary*", + "*python: commands succeeded" + ]) + old.chdir() + # see that tests can also fail and retcode is correct + testfile = py.path.local("tests").join("test_hello.py") + assert testfile.check() + testfile.write("def test_fail(): assert 0") + result = cmd.run("tox", ) + assert result.ret + result.stdout.fnmatch_lines([ + "*1 failed*", + "*summary*", + "*python: *failed*", + ]) + + def test_test_piphelp(initproj, cmd): initproj("example123", filedefs={'tox.ini': """ # content of: tox.ini diff --git a/tox/_venv.py b/tox/_venv.py index 7b7f4e6..d25f1b2 100644 --- a/tox/_venv.py +++ b/tox/_venv.py @@ -209,8 +209,8 @@ class VirtualEnv(object): name = output.strip().decode('utf-8') egg_info = setupdir.join('.'.join((name, 'egg-info'))) for conf_file in (setup_py, setup_cfg): - if (conf_file.check() - and conf_file.mtime() > egg_info.mtime()): + if (not egg_info.check() or (conf_file.check() + and conf_file.mtime() > egg_info.mtime())): return True return False -- cgit v1.2.1