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
Using the python project scheme suggested by the pytest documentation, pymode does not include the tests/ directory into its ropeproject when the “include method” of the src/ directory is done via an editable install (pip install -e .).
How do I add an additional source directory to PymodeRope, namely the tests/ directory?
Minimal working example
First create a venv virtual environment as well as a temporary directory. The abbreviation pmt stands for “pymode test”.
open the source file with vim /tmp/pmt/src/pmt/spam.py
move the cursor to spamfunc
start function renaming by hitting <C-c>rr
insert a different name, for instance hamfunc and press <Enter>
perform the renaming by inserting 1<Enter>
After that, the renaming was successfully done in /tmp/pmt/src/pmt/spam.py and /tmp/pmt/src/pmt/bacon.pybut not intmp/pmt/tests/test_pmt.py (as I expect).
What I have tried
I tried to add manually the tests directory to the .ropeproject/config.py file
defset_prefs(prefs):
# … more code of the default config.py file …# Custom source folders: By default rope searches the project# for finding source folders (folders that should be searched# for finding modules). You can add paths to that list. Note# that rope guesses project source folders correctly most of the# time; use this if you have any problems.# The folders should be relative to project root and use '/' for# separating folders regardless of the platform rope is running on.# 'src/my_source_folder' for instance.prefs.add('source_folders', 'tests')
# … more code of the default config.py file …
with no success.
When I change the import policy by
uninstalling the module again with (pmt) $ python -m pip uninstall pmt
change the imports of tmp/pmt/tests/test_pmt.py to
Using the python project scheme suggested by the pytest documentation, pymode does not include the
tests/
directory into itsropeproject
when the “include method” of thesrc/
directory is done via an editable install (pip install -e .
).How do I add an additional source directory to
PymodeRope
, namely thetests/
directory?Minimal working example
First create a
venv
virtual environment as well as a temporary directory. The abbreviationpmt
stands for “pymode test”.Create the three source files with an editor of your choice, namely
The project directory will look like this:
As suggested by
pytest
, install the editable version of the package and invokepytest
:To finally reproduce the behaviour:
vim /tmp/pmt/src/pmt/spam.py
spamfunc
<C-c>rr
hamfunc
and press<Enter>
1<Enter>
After that, the renaming was successfully done in
/tmp/pmt/src/pmt/spam.py
and/tmp/pmt/src/pmt/bacon.py
but not intmp/pmt/tests/test_pmt.py
(as I expect).What I have tried
I tried to add manually the
tests
directory to the.ropeproject/config.py
filewith no success.
When I change the import policy by
(pmt) $ python -m pip uninstall pmt
tmp/pmt/tests/test_pmt.py
tothen the renaming as suggested above does work, but that project structure is not as I or the
pytest
guys, respectively, want it to be.Used versions
Pymode version:
commit 85d2cd1a196ac1def79d4599b5be69395ed5b603 (HEAD → develop)
The text was updated successfully, but these errors were encountered: