Skip to content

Commit ff7f0cb

Browse files
committed
tests: conftest: update fw_version fixture to the new build system changes
Signed-off-by: Filipe Laíns <[email protected]>
1 parent 74f9337 commit ff7f0cb

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

tests/conftest.py

+3-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# SPDX-FileCopyrightText: 2021 Filipe Laíns <[email protected]>
33

44
import contextlib
5-
import importlib.util
65
import os
76
import os.path
87
import unittest.mock
@@ -11,6 +10,8 @@
1110
import pytest
1211
import testsuite
1312

13+
import build_system
14+
1415

1516
root_dir = os.path.abspath(os.path.join(__file__, '..', '..'))
1617

@@ -25,15 +26,6 @@ def cd(*path_paths):
2526
os.chdir(old_cwd)
2627

2728

28-
def import_file(name, path):
29-
spec = importlib.util.spec_from_file_location(name, path)
30-
if not spec.loader:
31-
raise ImportError(f'Unable to import `{path}`: no loader')
32-
module = importlib.util.module_from_spec(spec)
33-
spec.loader.exec_module(module) # type: ignore
34-
return module
35-
36-
3729
@pytest.fixture()
3830
def device(request):
3931
return testsuite.Device(
@@ -59,8 +51,4 @@ def basic_device():
5951

6052
@pytest.fixture()
6153
def fw_version():
62-
with cd(root_dir):
63-
configure = import_file('configure', 'configure.py')
64-
version = configure.BuildSystemBuilder.calculate_version()
65-
is_dirty = configure.BuildSystemBuilder._is_git_dirty()
66-
return f'{version}.dirty' if is_dirty else version
54+
return build_system.VersionInfo.from_git().full_string

0 commit comments

Comments
 (0)