debian-forge/test/mod/test_testutil_imports.py
Michael Vogt 061501d4c2 osbuild: add new testutil.imports module to help test stages
This commit adds `osbuild.testutil.imports.import_module_from_path`
that can be used to import arbitrary python source files. This
allows importing files from the stages directory that have a
non python friendly filename like `org.osbuild.kickstart`.
2023-11-07 15:12:08 +01:00

17 lines
332 B
Python

#
# Tests for the 'osbuild.util.testutil' module.
#
import os.path
import tempfile
import pytest
from osbuild.testutil.imports import import_module_from_path
canary = "import-went-okay"
def test_import_module_from_path_happy():
mod = import_module_from_path("myself", __file__)
assert mod.canary == "import-went-okay"