Skip to content

Commit

Permalink
Fix the type validation wrapper to honor the package_src argument of …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
dwighthubbard and Dwight Hubbard authored Mar 23, 2021
1 parent b78b6e5 commit c5d686c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.d/105.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The type validation is fixed to honor the package_dir directive in the package if it is present
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ classifiers =
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
description = Python helper utilities for screwdriver CI/CD
keywords = ci, cd, screwdriver
long_description = file:README.md
Expand Down
5 changes: 1 addition & 4 deletions src/screwdrivercd/validation/validate_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
def validate_with_mypy(report_dir):
"""Run the mypy command directly to do the validation"""

src_dir = os.environ.get('PACKAGE_DIR', '')
if not src_dir:
src_dir = os.environ.get('PACKAGE_DIRECTORY', '')

src_dir = package_srcdir()
package_name = PackageMetadata().metadata['name']

# Generate the command line from the environment settings
Expand Down
6 changes: 6 additions & 0 deletions tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ def test__mypy__valid(self):
result = validate_type()
self.assertEqual(result, 0)

def test__mypy__valid__nopackage_dir__env(self):
os.environ['TYPE_CHECK_ENFORCING'] = 'True'
self.write_config_files(working_config)
result = validate_type()
self.assertEqual(result, 0)

def test__mypy__valid__mypy_args(self):
os.environ['PACKAGE_DIR'] = 'src'
os.environ['TYPE_CHECK_ENFORCING'] = 'True'
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package_dir = src/screwdrivercd
package_name = screwdrivercd

[tox]
envlist = py36,py37,py38
envlist = py36,py37,py38,py39
skip_missing_interpreters = true

[testenv]
Expand Down

0 comments on commit c5d686c

Please sign in to comment.