[TIP] New project workflow and best practices
Gabriele Lanaro
gabriele.lanaro at gmail.com
Thu Nov 11 01:42:04 PST 2010
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:
1) create a directory structure and a setup script:
bashpy/
setup.cfg
README
bashpy/
__init__.py
commands.py
tests/
__init__.py
test_commands.py
2) Write some functions in the bashpy.commands module, say `mkdir(src)` and
`rm(src)`
3) Write test classes in test_commands.py
from bashpy.commands import mkdir,rm
import unittest2 as unittest
class TestRm(unittest.TestCase):
def test1 ...
class TestCp ....
4) Run the tests
from the root directory
$ unit2 discover
... correct output from the tests ...
... oh! I failed TestRm.test1 !!!...
5) Run a specific test to solve problems:
$ unit2 bashpy.tests.test_commands.TestRm.test1
ImportError: No module named bashpy
What I'm doing wrong? There's a similar linear workflow/best practices used
to avoid import problems etc?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20101111/b7a0c286/attachment.htm>
More information about the testing-in-python
mailing list