Skip to content

CI: fix failing script/tests #40457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 16, 2021
Merged

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jbrockmendel ,

bit confused here, don't these tests pass already? I just tried pull master and they seem fine:

$ cd scripts/
$ pytest
======================================== test session starts =========================================
platform linux -- Python 3.8.6, pytest-6.2.2, py-1.9.0, pluggy-0.13.1
rootdir: /home/marco/pandas-marco, configfile: setup.cfg
plugins: hypothesis-6.8.1, cov-2.11.1, instafail-0.4.1, monkeytype-1.1.0, forked-1.2.0, xdist-2.2.1, asyncio-0.14.0
collected 72 items                                                                                   

tests/test_inconsistent_namespace_check.py ........                                            [ 11%]
tests/test_no_bool_in_generic.py ....                                                          [ 16%]
tests/test_validate_docstrings.py .....................................                        [ 68%]
tests/test_validate_unwanted_patterns.py .......................                               [100%]

========================================= 72 passed in 1.38s =========================================

Also, tokenize-rt is a dependency of pyupgrade so I didn't think it would be necessary to include it in the environment file


EDIT

Running from the root directory also works:

$ pytest scripts/
======================================== test session starts =========================================
platform linux -- Python 3.8.6, pytest-6.2.2, py-1.9.0, pluggy-0.13.1
rootdir: /home/marco/pandas-marco, configfile: setup.cfg
plugins: hypothesis-6.8.1, cov-2.11.1, instafail-0.4.1, monkeytype-1.1.0, forked-1.2.0, xdist-2.2.1, asyncio-0.14.0
collected 72 items                                                                                   

scripts/tests/test_inconsistent_namespace_check.py ........                                    [ 11%]
scripts/tests/test_no_bool_in_generic.py ....                                                  [ 16%]
scripts/tests/test_validate_docstrings.py .....................................                [ 68%]
scripts/tests/test_validate_unwanted_patterns.py .......................                       [100%]

========================================= 72 passed in 1.37s =========================================

As for how to run them, I think the import validate_docstrings in test_validate_docstrings.py (which predates me) suggests they should be run from within scripts

Also, this is already checked here:

- name: Testing docstring validation script
run: pytest --capture=no --strict-markers scripts
if: always()

@jbrockmendel
Copy link
Member Author

jbrockmendel commented Mar 16, 2021

Also, tokenize-rt is a dependency of pyupgrade so I didn't think it would be necessary to include it in the environment file

Makes sense, will revert

@jbrockmendel
Copy link
Member Author

bit confused here, don't these tests pass already? I just tried pull master and they seem fine:

what flake8 version are you using?

@jbrockmendel
Copy link
Member Author

Running from the root directory also works:

$ pytest scripts/
______________________________________ ERROR collecting scripts/tests/test_inconsistent_namespace_check.py ______________________________________
ImportError while importing test module '~/pd/pandas/scripts/tests/test_inconsistent_namespace_check.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/[email protected]/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
scripts/tests/test_inconsistent_namespace_check.py:3: in <module>
    from scripts.check_for_inconsistent_pandas_namespace import (
E   ModuleNotFoundError: No module named 'scripts'

$ cd scripts
$ pytest
______________________________________ ERROR collecting scripts/tests/test_inconsistent_namespace_check.py ______________________________________
ImportError while importing test module '~/pd/pandas/scripts/tests/test_inconsistent_namespace_check.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/[email protected]/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_inconsistent_namespace_check.py:3: in <module>
    from scripts.check_for_inconsistent_pandas_namespace import (
E   ModuleNotFoundError: No module named 'scripts'

@jreback jreback added the CI Continuous Integration label Mar 16, 2021
@jreback jreback added this to the 1.3 milestone Mar 16, 2021
@jreback
Copy link
Contributor

jreback commented Mar 16, 2021

cool merge when ready @MarcoGorelli @jbrockmendel

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Mar 16, 2021

bit confused here, don't these tests pass already? I just tried pull master and they seem fine:

what flake8 version are you using?

Ah yeah, I had 3.8.4, hadn't done conda env update -f environment.yml...I thought we'd solved the issues with inconsistent linter versions, but this check uses the conda env version. IMO it makes sense to move it to pre-commit too so this doesn't happen again, will work on that later

Thanks for fixing this + explaining!


Just to clarify, it's not #40439 which broke the check, but the fact that flake8 isn't pinned in environment.yml, as that's the version used by this check

@MarcoGorelli MarcoGorelli merged commit dc548fd into pandas-dev:master Mar 16, 2021
@jbrockmendel jbrockmendel deleted the ci-scripts branch March 16, 2021 16:51
@simonjayhawkins
Copy link
Member

@meeseeksdev backport 1.2.x

@lumberbot-app

This comment has been minimized.

simonjayhawkins pushed a commit to simonjayhawkins/pandas that referenced this pull request Mar 25, 2021
simonjayhawkins added a commit that referenced this pull request Mar 25, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
* CI: fix failing script/tests

* get tokenize_rt from pip

* revert tokenize_rt dep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants