Skip to content

Not able to run tests locally #10666

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

Closed
rohitgr7 opened this issue Nov 21, 2021 · 6 comments
Closed

Not able to run tests locally #10666

rohitgr7 opened this issue Nov 21, 2021 · 6 comments
Labels
bug Something isn't working ci Continuous Integration

Comments

@rohitgr7
Copy link
Contributor

rohitgr7 commented Nov 21, 2021

🐛 Issue with tests

Something after v1.5.2 broke pytest.

Code:

git clone master
pip install -r requirements.txt
pip install -r requirements/test.txt
pip install -r requirements/extra.txt
pytest tests/utilities -v

Error:

File "/Users/goku/miniconda3/envs/pl_test/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 143, in main
    config = _prepareconfig(args, plugins)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1283, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1191, in _preparse
    self.hook.pytest_load_initial_conftests(
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/pluggy/_callers.py", line 34, in _multicall
    next(gen)  # first yield
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/warnings.py", line 136, in pytest_load_initial_conftests
    with catch_warnings_for_item(
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/warnings.py", line 52, in catch_warnings_for_item
    apply_warning_filters(config_filters, cmdline_filters)
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1603, in apply_warning_filters
    warnings.filterwarnings(*parse_warning_filter(arg, escape=False))
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1579, in parse_warning_filter
    category: Type[Warning] = warnings._getcategory(category_)  # type: ignore[attr-defined]
  File "/Users/goku/miniconda3/envs/pl_test/lib/python3.9/warnings.py", line 262, in _getcategory
    raise _OptionError("invalid module name: %r" % (module,)) from None
warnings._OptionError: invalid module name: 'pytorch_lightning.utilities.warnings'

Was working fine until v1.5.2

Expected behavior

Working fine if you either do:

python -m pytest tests/utilities -v

or install lightning in environment

pip install -e .

The issue is coming up only on mac for me. Working fine on Ubuntu (Linux), not sure about Windows.

Environment

  • PyTorch Lightning Version (e.g., 1.3.0): master
  • PyTorch Version (e.g., 1.8)
  • Python version: 3.9
  • OS (e.g., Linux): mac
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • How you installed PyTorch (conda, pip, source):
  • If compiling from source, the output of torch.__config__.show():
  • Any other relevant information:

Additional context

cc: @carmocca

cc @carmocca @akihironitta @Borda

@rohitgr7 rohitgr7 added the bug Something isn't working label Nov 21, 2021
@carmocca
Copy link
Contributor

This seems to be working as expected, given the discussion in pytest-dev/pytest#8343.

@carmocca carmocca added ci Continuous Integration and removed tests labels Nov 22, 2021
@daniellepintz
Copy link
Contributor

I am experiencing the same issue, @rohitgr7 were you able to find a workaround?

@rohitgr7
Copy link
Contributor Author

@daniellepintz this is what's working for me now

python -m pytest tests/utilities -v

@daniellepintz
Copy link
Contributor

I got it to work as well by reinstalling all deps...

@awaelchli
Copy link
Contributor

Had it inside docker right now. Had to do pip install -e . and it was solved.

@tchaton
Copy link
Contributor

tchaton commented Nov 26, 2021

It seems it is working now, let's close this issue.

@tchaton tchaton closed this as completed Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci Continuous Integration
Projects
None yet
Development

No branches or pull requests

6 participants