Skip to content
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

Cannot run pytest #88

Closed
alessio-izzo opened this issue Jun 27, 2019 · 5 comments
Closed

Cannot run pytest #88

alessio-izzo opened this issue Jun 27, 2019 · 5 comments

Comments

@alessio-izzo
Copy link

Hi, I recently had an issue running any test with pytest where the env variables where set by an .env file. This is the error message given by pycharm:

INTERNALERROR> self.ensure_test_start_reported(self.format_test_id(nodeid, location), test_name)
INTERNALERROR> File "/Applications/PyCharm CE.app/Contents/helpers/pycharm/teamcity/pytest_plugin.py", line 217, in ensure_test_start_reported
INTERNALERROR> self.teamcity.testStarted(test_id, flowId=test_id, captureStandardOutput=capture_standard_output, metainfo=metainfo)
INTERNALERROR> File "/Applications/PyCharm CE.app/Contents/helpers/pycharm/_jb_runner_tools.py", line 177, in testStarted
INTERNALERROR> commands = _TREE_MANAGER_HOLDER.manager.level_opened(self._test_to_list(testName), _write_start_message)
INTERNALERROR> File "/Applications/PyCharm CE.app/Contents/helpers/pycharm/_jb_runner_tools.py", line 50, in manager
INTERNALERROR> self._fill_manager()
INTERNALERROR> File "/Applications/PyCharm CE.app/Contents/helpers/pycharm/_jb_runner_tools.py", line 58, in _fill_manager
INTERNALERROR> from _jb_serial_tree_manager import SerialTreeManager
INTERNALERROR> ImportError: No module named _jb_serial_tree_manager

========================= no tests ran in 2.81 seconds =========================

Process finished with exit code 0

Empty suite

These are my settings:
PyCharm 2019.1.3 (Community Edition)
Build #PC-191.7479.30, built on May 29, 2019
JRE: 11.0.2+9-b159.60 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.5
The EnvFile version is 3.2.0
If I uncheck the use of the .env file, the tests run correctly.

@ashald
Copy link
Owner

ashald commented Jun 27, 2019

I don't think it's related to the plugin - maybe some of the env vars you set break it?

@alessio-izzo
Copy link
Author

Yes. I found out that the problem occurs when setting the PYTHONPATH variable. If I set PYTHONPATH into the file, the error is raised.

@ashald
Copy link
Owner

ashald commented Jun 27, 2019

Glad you was able to figure it out! 😊

@ashald ashald closed this as completed Jun 27, 2019
@alessio-izzo
Copy link
Author

But there is a right way to set PYTHONPATH into the .env file? I mean, have you ever tried setting the pythonpath variable? If I set it in the usual way, I don't have problems.

@ashald
Copy link
Owner

ashald commented Jun 29, 2019

You'd want to add a value to it rather than overwrite it altogether (as PyCharm manipulates it inject its helpers). For instance, if there is a dir src within your project that you want to add you can do it like this:

PYTHONPATH=src:${PYTHONPATH}

Also, don't forget to enable env var substitution as seen below:
image

P.S.: Please note that env var substitution is not a standard feature of env file format and is unlikely to work with anything else besides EnvFile plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants