File: test___init__.py

package info (click to toggle)
python-pytest-resource-path 1.3.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 192 kB
  • sloc: python: 398; makefile: 4
file content (48 lines) | stat: -rw-r--r-- 1,574 bytes parent folder | download
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