You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for reporting to Elpy !
I've configured my python system so that (elpy-project-root) is what I want it to be, but when I go run my tests elpy's default directory is the tests/ directory, not the project root, so it can't import the necessary files.
Steps to reproduce
run a test in a python test file - tests are in a directory parallel to the main body:
But when I run the tests (from test_category.py), for example, I get:
-*- mode: compilation; default-directory: "~/Development/ProductCatalog/tests/" -*-
Compilation started at Mon Nov 18 16:52:00
python -m pytest /Users/tobyferguson/Development/ProductCatalog/tests/test_image.py\:\:test_remove_image
======================= test session starts =======================
platform darwin -- Python 3.8.0, pytest-5.2.2, py-1.8.0, pluggy-0.13.0
rootdir: /Users/tobyferguson/Development/ProductCatalog
collected 0 items / 1 errors
============================= ERRORS ==============================
______________ ERROR collecting tests/test_image.py _______________
ImportError while importing test module '/Users/tobyferguson/Development/ProductCatalog/tests/test_image.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test_image.py:1: in <module>
from productcatalog import create_image, get_image, image_exists, remove_image
E ModuleNotFoundError: No module named 'productcatalog'
My configuration
OS
Mac OS 10.14.6 (Mojave)
Result of (elpy-config)
Elpy Configuration
Emacs.............: 26.3
Elpy..............: 1.31.0
Virtualenv........: productcatalog (/Users/tobyferguson/.virtualenvs/productcatalog)
Interactive Python: python 3.8.0 (/Users/tobyferguson/.virtualenvs/productcatalog/bin/python)
RPC virtualenv....: rpc-venv (/Users/tobyferguson/.emacs.d/elpy/rpc-venv)
Python...........: python 3.8.0 (/Users/tobyferguson/.emacs.d/elpy/rpc-venv/bin/python)
Jedi.............: 0.15.1
Rope.............: 0.14.0
Autopep8.........: 1.4.4
Yapf.............: 0.28.0
Black............: 19.10b0
Syntax checker....: Not found (flake8)
Warnings
The configured syntax checker could not be found. Elpy uses this
program to provide syntax checks of your programs, so you might want
to install one. Elpy by default uses flake8.
[Install flake8]
Options
`Raised' text indicates buttons; type RET or click mouse-1 on a button
to invoke its action. Invoke [+] to expand a group, and [-] to
collapse an expanded group. Invoke the [Group], [Face], and [Option]
buttons below to edit that item in another window.
[+]-- Group Elpy
[+]-- Group Python
[+]-- Group Virtual Environments (Pyvenv)
[+]-- Group Completion (Company)
[+]-- Group Call Signatures (ElDoc)
[+]-- Group Inline Errors (Flymake)
[+]-- Group Snippets (YASnippet)
[+]-- Group Directory Grep (rgrep)
[+]-- Group Search as You Type (ido)
[+]-- Group Django extension
[+]-- Group Autodoc extension
I stepped out for a few minutes and had the idea to run pip install -e .. Once I'd done that then elpy started to work as expected. I haven't figured it out yet, but that fixed the issue. It might be worth a note in the docs that this might be the problem, for other poor souls like me who spend an hour or so trying to get elpy to work :-(
Summary
Thank you for reporting to Elpy !
I've configured my python system so that (elpy-project-root) is what I want it to be, but when I go run my tests elpy's default directory is the tests/ directory, not the project root, so it can't import the necessary files.
Steps to reproduce
run a test in a python test file - tests are in a directory parallel to the main body:
But when I run the tests (from test_category.py), for example, I get:
My configuration
OS
Mac OS 10.14.6 (Mojave)
Result of
(elpy-config)
Elpy configuration in my init.el
The text was updated successfully, but these errors were encountered: