josiahcarlson/rom — pull request #11 by 72squared (2013-09-11 14:01:05+00:00)
Title: code reorganization for better separation of concerns.

I refactored the tests to be in individual files so it is easier to run a smaller set of tests in isolation. Example:

py.test test/test_saving.py -v

================= test session starts ==================
platform linux2 -- Python 2.7.5 -- pytest-2.3.5 -- /opt/pyvenv27/bin/python2.7
collected 4 items

test/test_saving.py:10: test_save_inline_with_no_attributes PASSED
test/test_saving.py:13: test_save_inline_with_attributes PASSED
test/test_saving.py:16: test_save_with_no_changes PASSED
test/test_saving.py:23: test_create_w_id PASSED

=============== 4 passed in 0.39 seconds ===============

Or it is easy enough to run the entire test suite:

py.test test/
================= test session starts ==================
platform linux2 -- Python 2.7.5 -- pytest-2.3.5
collected 41 items

test/test_alternate_foriegn_models.py .
test/test_basic.py ....
test/test_boolean.py ..
test/test_connections.py .
test/test_datatypes.py ............
test/test_datetime.py .
test/test_delete.py .
test/test_entity_caching.py .
test/test_foriegn_key.py ...
test/test_index.py ......
test/test_json.py .
test/test_saving.py ....
test/test_unique.py ....

============== 41 passed in 1.35 seconds ===============

Inside the test file I replicated all the tests you had in your previous monolithic test class so it verifies all the code functions the same.

At this point I haven't changed any behavior. I plan to spend more time fleshing out the unit tests to make sure I am not missing anything about the existing behavior of rom.

As for the module reorganization, I didn't change anything in the api or how it functions. This just makes it easier for me to be able to see what each class does and what the dependencies are.