Skip to content

Commit c5d686c

Browse files
dwighthubbardDwight Hubbard
andauthored
Fix the type validation wrapper to honor the package_src argument of the package configuration (#106)
* Make validate_style actually use the directories for the packages from the package metadata. * Make validate_style actually use the directories for the packages from the package metadata. * Make validate_style actually use the directories for the packages from the package metadata. * Fix test since the interpreter can have the version at the end * Default the pip3 dependencies installer to installing for the BASE_PYTHON interpreter by default instead of the first python3 interpreter found in the path. * Default the pip3 dependencies installer to installing for the BASE_PYTHON interpreter by default instead of the first python3 interpreter found in the path. Co-authored-by: Dwight Hubbard <[email protected]>
1 parent b78b6e5 commit c5d686c

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

changelog.d/105.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The type validation is fixed to honor the package_dir directive in the package if it is present

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ classifiers =
99
Programming Language :: Python :: 3.6
1010
Programming Language :: Python :: 3.7
1111
Programming Language :: Python :: 3.8
12+
Programming Language :: Python :: 3.9
1213
description = Python helper utilities for screwdriver CI/CD
1314
keywords = ci, cd, screwdriver
1415
long_description = file:README.md

src/screwdrivercd/validation/validate_type.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
def validate_with_mypy(report_dir):
3333
"""Run the mypy command directly to do the validation"""
3434

35-
src_dir = os.environ.get('PACKAGE_DIR', '')
36-
if not src_dir:
37-
src_dir = os.environ.get('PACKAGE_DIRECTORY', '')
38-
35+
src_dir = package_srcdir()
3936
package_name = PackageMetadata().metadata['name']
4037

4138
# Generate the command line from the environment settings

tests/test_validators.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ def test__mypy__valid(self):
242242
result = validate_type()
243243
self.assertEqual(result, 0)
244244

245+
def test__mypy__valid__nopackage_dir__env(self):
246+
os.environ['TYPE_CHECK_ENFORCING'] = 'True'
247+
self.write_config_files(working_config)
248+
result = validate_type()
249+
self.assertEqual(result, 0)
250+
245251
def test__mypy__valid__mypy_args(self):
246252
os.environ['PACKAGE_DIR'] = 'src'
247253
os.environ['TYPE_CHECK_ENFORCING'] = 'True'

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package_dir = src/screwdrivercd
33
package_name = screwdrivercd
44

55
[tox]
6-
envlist = py36,py37,py38
6+
envlist = py36,py37,py38,py39
77
skip_missing_interpreters = true
88

99
[testenv]

0 commit comments

Comments
 (0)