Skip to content

Commit

Permalink
Fix type annotations in sst_unittest_support.py (#1176)
Browse files Browse the repository at this point in the history
* add Python type annotations to tests

* fix Python string escaping

* sst_unittest_support.py: fix type annotations

* sst_unittest_support.py: fix comparisons against None

* sst_unittest_support.py: don't use match keyword as variable name

* sst_unittest_support.py: deduplicate implementation in testing_compare_filtered_subset

* sst_unittest_support.py: remove outdated call to platform.linux_distribution

* sst_unittest_support.py: update type annotations for comparing filtered lines

* pyproject.toml: update mypy configuration

* sst_unittest_support.py: fix specificity of generic type parameters
  • Loading branch information
berquist authored Dec 2, 2024
1 parent 5b7d8df commit 17909eb
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 168 deletions.
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
[tool.mypy]
cache_dir = "build/.mypy_cache"
explicit_package_bases = true
mypy_path = "$MYPY_CONFIG_FILE_DIR/src/sst/core/testingframework"
# This should be 3.6 but is not supported with the newest versions of mypy.
python_version = "3.8"

warn_unused_ignores = true

warn_return_any = true
warn_unused_configs = true

disallow_untyped_defs = true
strict = true

exclude = [
'^scripts/',
'^tests/',
]

[[tool.mypy.overrides]]
module = "sst"
module = [
"blessings",
"sst",
"testtools",
"testtools.testsuite",
]
ignore_missing_imports = true
2 changes: 1 addition & 1 deletion src/sst/core/model/python/unittests/test-ua.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
ua3_id_before = id(ua3)
ua3 /= ua2
if id(ua3) == ua3_id_before:
print("ERROR: \= operator returned the same object")
print(r"ERROR: \= operator returned the same object")
print(ua3)
print(ua4)

Expand Down
Loading

0 comments on commit 17909eb

Please sign in to comment.