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`.
17 lines
332 B
Python
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"
|