Skip to content

Commit

Permalink
Merge pull request #3015 from jurko-gospodnetic/code-cleanup
Browse files Browse the repository at this point in the history
Code cleanup
  • Loading branch information
nicoddemus committed Dec 12, 2017
2 parents 771b5c8 + 3b85e0c commit 5c6d773
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 187 deletions.
330 changes: 161 additions & 169 deletions _pytest/pytester.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions changelog/3015.trivial
@@ -0,0 +1 @@
Code cleanup.
18 changes: 9 additions & 9 deletions testing/acceptance_test.py
Expand Up @@ -215,8 +215,8 @@ def test_chdir(self, testdir):
assert not result.ret

def test_issue109_sibling_conftests_not_loaded(self, testdir):
sub1 = testdir.tmpdir.mkdir("sub1")
sub2 = testdir.tmpdir.mkdir("sub2")
sub1 = testdir.mkdir("sub1")
sub2 = testdir.mkdir("sub2")
sub1.join("conftest.py").write("assert 0")
result = testdir.runpytest(sub2)
assert result.ret == EXIT_NOTESTSCOLLECTED
Expand Down Expand Up @@ -603,11 +603,11 @@ def test_cmdline_python_namespace_package(self, testdir, monkeypatch):
# The structure of the test directory is now:
# .
# ├── hello
# │   └── ns_pkg
# │   ├── __init__.py
# │   └── hello
# │   ├── __init__.py
# │   └── test_hello.py
# │ └── ns_pkg
# │ ├── __init__.py
# │ └── hello
# │ ├── __init__.py
# │ └── test_hello.py
# └── world
# └── ns_pkg
# ├── __init__.py
Expand All @@ -624,10 +624,9 @@ def join_pythonpath(*dirs):
for p in search_path:
monkeypatch.syspath_prepend(p)

os.chdir('world')
# mixed module and filenames:
os.chdir('world')
result = testdir.runpytest("--pyargs", "-v", "ns_pkg.hello", "ns_pkg/world")
testdir.chdir()
assert result.ret == 0
result.stdout.fnmatch_lines([
"*test_hello.py::test_hello*PASSED*",
Expand All @@ -638,6 +637,7 @@ def join_pythonpath(*dirs):
])

# specify tests within a module
testdir.chdir()
result = testdir.runpytest("--pyargs", "-v", "ns_pkg.world.test_world::test_other")
assert result.ret == 0
result.stdout.fnmatch_lines([
Expand Down
8 changes: 2 additions & 6 deletions testing/test_conftest.py
Expand Up @@ -84,7 +84,7 @@ def test_conftest_in_nonpkg_with_init(tmpdir):

def test_doubledash_considered(testdir):
conf = testdir.mkdir("--option")
conf.join("conftest.py").ensure()
conf.ensure("conftest.py")
conftest = PytestPluginManager()
conftest_setinitial(conftest, [conf.basename, conf.basename])
values = conftest._getconftestmodules(conf)
Expand Down Expand Up @@ -270,11 +270,7 @@ def pytest_addoption(parser):
parser.addoption("--hello-world", action="store_true")
"""))
p = sub.join("test_hello.py")
p.write(py.std.textwrap.dedent("""
import pytest
def test_hello(found):
assert found == 1
"""))
p.write("def test_hello(): pass")
result = testdir.runpytest(str(p) + "::test_hello", "-h")
result.stdout.fnmatch_lines("""
*--hello-world*
Expand Down
2 changes: 1 addition & 1 deletion testing/test_pdb.py
Expand Up @@ -338,7 +338,7 @@ def test_foo(a):
self.flush(child)

def test_pdb_collection_failure_is_shown(self, testdir):
p1 = testdir.makepyfile("""xxx """)
p1 = testdir.makepyfile("xxx")
result = testdir.runpytest_subprocess("--pdb", p1)
result.stdout.fnmatch_lines([
"*NameError*xxx*",
Expand Down
2 changes: 1 addition & 1 deletion testing/test_pytester.py
Expand Up @@ -141,7 +141,7 @@ def test_inline_run_clean_modules(testdir):
assert result2.ret == EXIT_TESTSFAILED


def test_assert_outcomes_after_pytest_erro(testdir):
def test_assert_outcomes_after_pytest_error(testdir):
testdir.makepyfile("def test_foo(): assert True")

result = testdir.runpytest('--unexpected-argument')
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -138,7 +138,7 @@ commands =
basepython = python
usedevelop = True
skipsdist = True
# ensure the given pyargs cant mean anytrhing else
# ensure the given pyargs can't mean anything else
changedir = doc/
deps =
PyYAML
Expand Down

0 comments on commit 5c6d773

Please sign in to comment.