Skip to content

Commit d378d0f

Browse files
Fix packaging deprecation and flake8 regression in tests (#156)
1 parent 921fe5c commit d378d0f

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

test/spell_check.words

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ findtext
1919
getaffinity
2020
github
2121
https
22+
importorskip
2223
iterdir
2324
kazys
2425
kislyuk
@@ -28,6 +29,7 @@ lstrip
2829
makefile
2930
makefiles
3031
makeflags
32+
minversion
3133
modline
3234
monkeypatch
3335
msbuild

test/test_parse_cmake_version.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
# Licensed under the Apache License, Version 2.0
33

44
from colcon_cmake.task.cmake import _parse_cmake_version_string
5+
import pytest
56

67

78
def test_parse_cmake_version():
9+
# This test requires packaging v17 or newer, but the underlying code
10+
# is more flexible.
11+
pytest.importorskip('packaging', minversion='17')
12+
813
# Build version prefix string closely matching what cmake version outputs.
914
base_prefix = 'cmake version '
1015

@@ -33,7 +38,7 @@ def test_parse_cmake_version():
3338
# Input string was garbage. Assert parsing failed.
3439
assert parsed_version is None
3540
else:
36-
assert parsed_version._version.release[0:3] == expected_version
41+
assert parsed_version.release[0:3] == expected_version
3742

3843

3944
if __name__ == '__main__':

test/test_spell_check.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
@pytest.fixture(scope='module')
1212
def known_words():
13-
global spell_check_words_path
1413
return spell_check_words_path.read_text().splitlines()
1514

1615

0 commit comments

Comments
 (0)