Introduce pytest command as recommended entry point

Fixes #1629
This commit is contained in:
Dave Hunt
2016-06-21 16:16:57 +02:00
parent 54872e94b4
commit ef9dd14963
55 changed files with 272 additions and 274 deletions

View File

@@ -1,6 +1,6 @@
"""
This is the script that is actually frozen into an executable: simply executes
py.test main().
pytest main().
"""
if __name__ == '__main__':

View File

@@ -8,7 +8,7 @@ if __name__ == '__main__':
setup(
name="runtests",
version="0.1",
description="exemple of how embedding py.test into an executable using cx_freeze",
description="exemple of how embedding pytest into an executable using cx_freeze",
executables=[Executable("runtests_script.py")],
options={"build_exe": {'includes': pytest.freeze_includes()}},
)

View File

@@ -18,7 +18,7 @@ class TestParseIni:
assert config.inicfg['name'] == 'value'
def test_getcfg_empty_path(self, tmpdir):
getcfg([''], ['setup.cfg']) #happens on py.test ""
getcfg([''], ['setup.cfg']) #happens on pytest ""
def test_append_parse_args(self, testdir, tmpdir, monkeypatch):
monkeypatch.setenv('PYTEST_ADDOPTS', '--color no -rs --tb="short"')

View File

@@ -21,8 +21,8 @@ def test_help(testdir):
*-v*verbose*
*setup.cfg*
*minversion*
*to see*markers*py.test --markers*
*to see*fixtures*py.test --fixtures*
*to see*markers*pytest --markers*
*to see*fixtures*pytest --fixtures*
""")
def test_hookvalidation_unknown(testdir):

View File

@@ -362,7 +362,7 @@ class TestPython:
file="test_collect_skipped.py",
name="test_collect_skipped")
# py.test doesn't give us a line here.
# pytest doesn't give us a line here.
assert tnode["line"] is None
fnode = tnode.find_first_by_tag("skipped")

View File

@@ -246,8 +246,8 @@ def test_argcomplete(testdir, monkeypatch):
pytest.skip("bash not available")
script = str(testdir.tmpdir.join("test_argcomplete"))
pytest_bin = sys.argv[0]
if "py.test" not in os.path.basename(pytest_bin):
pytest.skip("need to be run with py.test executable, not %s" %(pytest_bin,))
if "pytest" not in os.path.basename(pytest_bin):
pytest.skip("need to be run with pytest executable, not %s" %(pytest_bin,))
with open(str(script), 'w') as fp:
# redirect output from argcomplete to stdin and stderr is not trivial
@@ -262,8 +262,8 @@ def test_argcomplete(testdir, monkeypatch):
monkeypatch.setenv('COMP_WORDBREAKS', ' \\t\\n"\\\'><=;|&(:')
arg = '--fu'
monkeypatch.setenv('COMP_LINE', "py.test " + arg)
monkeypatch.setenv('COMP_POINT', str(len("py.test " + arg)))
monkeypatch.setenv('COMP_LINE', "pytest " + arg)
monkeypatch.setenv('COMP_POINT', str(len("pytest " + arg)))
result = testdir.run('bash', str(script), arg)
if result.ret == 255:
# argcomplete not found
@@ -280,8 +280,7 @@ def test_argcomplete(testdir, monkeypatch):
return
os.mkdir('test_argcomplete.d')
arg = 'test_argc'
monkeypatch.setenv('COMP_LINE', "py.test " + arg)
monkeypatch.setenv('COMP_POINT', str(len('py.test ' + arg)))
monkeypatch.setenv('COMP_LINE', "pytest " + arg)
monkeypatch.setenv('COMP_POINT', str(len('pytest ' + arg)))
result = testdir.run('bash', str(script), arg)
result.stdout.fnmatch_lines(["test_argcomplete", "test_argcomplete.d/"])