I started a new "almost dummy" project to test the new functionalities of unittest2 but I'm encountering a lot of issues, I think because I'm not finding the best practices of python testing. I'm looking for suggestion on how to approach the development, here's my workflow:<div>
<br></div><div>1) create a directory structure and a setup script:</div><div><br></div><div>bashpy/</div><div> setup.cfg</div><div> README</div><div> bashpy/</div><div> __init__.py</div><div>
commands.py</div><div> tests/</div><div> __init__.py</div><div> test_commands.py</div><div><br></div><div>2) Write some functions in the bashpy.commands module, say `mkdir(src)` and `rm(src)`</div>
<div><br></div><div>3) Write test classes in test_commands.py</div><div><br></div><div>from bashpy.commands import mkdir,rm</div><div>import unittest2 as unittest</div><div><br></div><div>class TestRm(unittest.TestCase):</div>
<div> def test1 ...</div><div><br></div><div>class TestCp ....</div><div><br></div><div>4) Run the tests</div><div><br></div><div>from the root directory</div><div><br></div><div>$ unit2 discover</div><div>... correct output from the tests ...</div>
<div>... oh! I failed TestRm.test1 !!!...</div><div><br></div><div>5) Run a specific test to solve problems:</div><div>$ unit2 bashpy.tests.test_commands.TestRm.test1</div><div>ImportError: No module named bashpy</div><div>
<br></div><div>What I'm doing wrong? There's a similar linear workflow/best practices used to avoid import problems etc?</div>