Preamble

Auto testing failure

Sometimes when you're trying to run test suite for recently cloned Git repository and found that Elpy can't properly define project's stem and when you're C-c C-t to test it up you got:

-*- mode: compilation; default-directory: "/usr/local/share/DVCS/" -*-
Compilation started at Tue Dec  6 11:03:03

python -m unittest discover
EEEEEEEEEEEpython: can't open file 'behavioral/strategy.py': [Errno 2] No such file or directory
E
======================================================================

Manual test discover

Meanwhile the manual test discoverer works pretty well:

cd ../python-patterns
python -m unittest discover
............................................................
----------------------------------------------------------------------
Ran 60 tests in 0.606s

OK
We have a lovely <MagicMock name='get_pet()' id='140012246876568'>
It says <MagicMock name='get_pet().speak()' id='140012246389088'>
We also have <MagicMock name='get_food()' id='140012246405360'>
We have a lovely <MagicMock name='get_pet()' id='140012246450360'>
It says <MagicMock name='get_pet().speak()' id='140012246483072'>
We also have <MagicMock name='get_food()' id='140012246484528'>
renaming /usr/local/share/DVCS/python-patterns/tests/test_command/foo.txt to /usr/local/share/DVCS/python-patterns/tests/test_command/bar.txt
renaming /usr/local/share/DVCS/python-patterns/tests/test_command/bar.txt to /usr/local/share/DVCS/python-patterns/tests/test_command/baz.txt
renaming /usr/local/share/DVCS/python-patterns/tests/test_command/baz.txt to /usr/local/share/DVCS/python-patterns/tests/test_command/bar.txt
renaming /usr/local/share/DVCS/python-patterns/tests/test_command/bar.txt to /usr/local/share/DVCS/python-patterns/tests/test_command/foo.txt
DecimalViewer: Subject New Data Name has data 20
HexViewer: Subject New Data Name has data 0x14
Scanning... Station is 1380 AM
Scanning... Station is 1510 AM
Scanning... Station is 1250 AM
Switching to FM
Switching to AM

Why it is so?

Idea

As Elpy author said about the compilation directory:

Elpy runs tests in the library root. If your current directory has an __init__.py file, Elpy assumes this directory is a package and moves up one directory. Does this help?

Verification

cd ../python-patterns
ls
append_output.sh
behavioral
creational
fundamental
__init__.py
other
__pycache__
README.md
run_all.sh
structural
tests

Solution

Just remove __init__.py out from repository main folder.



blog comments powered by Disqus

Published

07 December 2016

Categories

how-to emacs niceties

Tags