1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
"""Tests for __init__.py."""
class TestInit:
"""Tests for __init__.py."""
@staticmethod
def test_fixture(testdir_structure_for_testing_resource_path):
"""Fixture should be expected path."""
# run pytest
result = testdir_structure_for_testing_resource_path.runpytest("-v")
# fnmatch_lines does an assertion internally
lines = [
"*::test_resource_path PASSED*",
"*::test_resource_path_root PASSED*",
"*::test_resource_path_root_scope_package PASSED*",
]
result.stdout.fnmatch_lines(lines)
# make sure that that we get a '0' exit code for the testsuite
assert result.ret == 0
@staticmethod
def test_fixture_with_ini(testdir_structure_for_testing_ini):
"""Fixture should be expected path with pytest.ini."""
testdir_structure_for_testing_ini.makeini(
"""
[pytest]
resource-path.directory-name-tests = integrationtests
resource-path.directory-name-test-resources = data
"""
)
# run pytest
result = testdir_structure_for_testing_ini.runpytest("-v")
# fnmatch_lines does an assertion internally
lines = [
"*::test_resource_path_ini PASSED*",
"*::test_resource_path_root_ini PASSED*",
"*::test_resource_path_root_scope_package_ini PASSED*",
]
result.stdout.fnmatch_lines(lines)
# make sure that that we get a '0' exit code for the testsuite
assert result.ret == 0
|