fix: failing ci checks with black and mypy (#4517)

pip21.3 has changed the behaviour of build - https://pip.pypa.io/en/stable/news/#v21-3 to use in-tree-build by default. this creates amalgamated files.

this will install as editable dependency during qa checks

for some reason mypy exclude for __amalgam__.py is not working
This commit is contained in:
Noorhteen Raja NJ 2021-10-15 02:31:44 +05:30 committed by GitHub
parent a5fcfba8be
commit 4b0918f9e3
Failed to generate hash of commit
6 changed files with 30 additions and 23 deletions

View file

@ -65,21 +65,26 @@ def write_to_file(
(CURR_DIR / fname).write_text(result)
# pytest workflows
for os_name, python_version in product(OS_NAMES, PYTHON_VERSIONS):
report_coverage = python_version == PY_MAIN_VERSION
if report_coverage:
test_cmd = "test --report-coverage --no-amalgam -- --timeout=240"
else:
test_cmd = "test -- --timeout=240"
def main():
# pytest workflows
for os_name, python_version in product(OS_NAMES, PYTHON_VERSIONS):
report_coverage = python_version == PY_MAIN_VERSION
if report_coverage:
test_cmd = "test --report-coverage --no-amalgam -- --timeout=240"
else:
test_cmd = "test -- --timeout=240"
write_to_file(
"pytest",
os_name,
python_version,
report_coverage=report_coverage,
test_cmd=test_cmd,
)
write_to_file(
"pytest",
os_name,
python_version,
report_coverage=report_coverage,
test_cmd=test_cmd,
)
# qa workflow
write_to_file("qa", "linux", PY_MAIN_VERSION, test_cmd="qa")
# qa workflow
write_to_file("qa", "linux", PY_MAIN_VERSION, test_cmd="qa")
if __name__ == "__main__":
main()

View file

@ -68,7 +68,7 @@ jobs:
run: |
python -m pip --version
python -m pip install -r requirements/tests.txt
python -m pip install{% if report_coverage %} -e{% endif %} . --no-deps
python -m pip install{% if report_coverage or (test_cmd == "qa") %} -e{% endif %} . --no-deps
- name: Run tests
run: python -m xonsh run-tests.xsh {{ test_cmd }}
{% if allow_failure %}

View file

@ -55,6 +55,6 @@ jobs:
run: |
python -m pip --version
python -m pip install -r requirements/tests.txt
python -m pip install . --no-deps
python -m pip install -e . --no-deps
- name: Run tests
run: python -m xonsh run-tests.xsh qa

View file

@ -21,8 +21,7 @@ exclude = '''
)
|
(
# and these additional random rules
( # and these additional random rules
/( __pycache__
| \.circleci
| \.github
@ -36,3 +35,5 @@ exclude = '''
extend_exclude = '''
((xonsh/parser_table.py)|(xonsh/completion_parser_table.py))
'''
force_exclude = '''.*/__amalgam__.py'''

View file

@ -70,9 +70,8 @@ def qa():
python -m flake8
mypy --version
# todo: add xontrib folder here
mypy xonsh --exclude xonsh/ply
mypy xonsh
pytest -m news

View file

@ -6,6 +6,8 @@
max-line-length = 180
exclude =
__amalgam__.py,
**/__amalgam__.py,
**/*/__amalgam__.py,
docs/,
*/ply/,
parser*_table.py,
@ -95,7 +97,7 @@ cache_dir = .cache/mypy/
warn_unused_configs = True
warn_no_return = False
; a regex to exclude certain directories
exclude = xonsh/ply
exclude = ((xonsh/ply)|(__amalgam__.py))
# report
show_error_context = True