File: pytest_dynamic_loader.py

package info (click to toggle)
cockpit 239-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 67,268 kB
  • sloc: javascript: 245,474; ansic: 72,273; python: 23,634; xml: 6,155; sh: 2,919; makefile: 923; sed: 5
file content (21 lines) | stat: -rw-r--r-- 690 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import fmf_metadata

"""
This wrapper allows to run cockpit tests via pytest e.g.
    MACHINE=127.0.0.2:2201 BROWSER=127.0.0.2:9091 TRACE=yes \
    PYTHONPATH=test/common/:test/verify/:bots/machine/ pytest -v \
    test/verify/pytest_dynamic_loader.py::TestLogin
"""


tests_path = os.path.realpath(os.getenv("TEST_PATH", os.path.dirname(__file__)))


def import_classes(path, testfile_globs):
    for filename in fmf_metadata.get_test_files(path, testfile_globs):
        for class_name, cls_dict in fmf_metadata.filepath_tests(filename).items():
            globals()[class_name] = cls_dict["class"]


import_classes(path=tests_path, testfile_globs=fmf_metadata.TESTFILE_GLOBS)