Commit 049bbb82 authored by Tres Seaver's avatar Tres Seaver

Add 'setup.py dev' alias

- Installs 'nose' and 'coverage'.
parent 262899e7
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
4.0 (unreleased) 4.0 (unreleased)
----------------- -----------------
- Added ``setup.py dev`` alias (installs ``nose`` and ``coverage``).
- Dropped dependency on ``zope.testing`` / ``zope.testrunner``: tests now - Dropped dependency on ``zope.testing`` / ``zope.testrunner``: tests now
run with ``setup.py test``. run with ``setup.py test``.
......
...@@ -5,24 +5,6 @@ This document covers "edge case" tests for the Persistent base class. ...@@ -5,24 +5,6 @@ This document covers "edge case" tests for the Persistent base class.
It should be replaced with normal unit tests. (The meat of the narrative It should be replaced with normal unit tests. (The meat of the narrative
documentation is now in ``docs/usage`` of the distribution). documentation is now in ``docs/usage`` of the distribution).
The test expects a class named `P` to be
provided in its globals. The `P` class implements the `Persistent`
interface.
Test framework
--------------
The class `P` needs to behave like `ExampleP`. (Note that the code below
is *not* part of the tests.)
::
class ExampleP(Persistent):
def __init__(self):
self.x = 0
def inc(self):
self.x += 1
The tests use stub data managers. A data manager is responsible for The tests use stub data managers. A data manager is responsible for
loading and storing the state of a persistent object. It's stored in loading and storing the state of a persistent object. It's stored in
the ``_p_jar`` attribute of a persistent object. the ``_p_jar`` attribute of a persistent object.
...@@ -55,6 +37,13 @@ registration fails, the exception is propagated and the object stays in the ...@@ -55,6 +37,13 @@ registration fails, the exception is propagated and the object stays in the
up-to-date state. It shouldn't change to the modified state, because it won't up-to-date state. It shouldn't change to the modified state, because it won't
be saved when the transaction commits. be saved when the transaction commits.
>>> from persistent import Persistent
>>> class P(Persistent):
... def __init__(self):
... self.x = 0
... def inc(self):
... self.x += 1
>>>
>>> p = P() >>> p = P()
>>> p._p_oid = 1 >>> p._p_oid = 1
>>> p._p_jar = BrokenDM() >>> p._p_jar = BrokenDM()
......
...@@ -52,6 +52,6 @@ if simple_new is not None: ...@@ -52,6 +52,6 @@ if simple_new is not None:
def test_suite(): def test_suite():
import doctest import doctest
return unittest.TestSuite(( return unittest.TestSuite((
doctest.DocFileSuite("persistent.txt", globs={"P": P}), doctest.DocFileSuite("persistent.txt"),
doctest.DocTestSuite(), doctest.DocTestSuite(),
)) ))
[nosetests]
nocapture=1
cover-package=persistent
cover-erase=1
with-doctest=0
where=persistent
ignore-files=wref.py
[aliases]
dev = develop easy_install persistent[testing]
...@@ -80,6 +80,7 @@ setup(name='persistent', ...@@ -80,6 +80,7 @@ setup(name='persistent',
tests_require = TESTS_REQUIRE, tests_require = TESTS_REQUIRE,
extras_require = { extras_require = {
'test': TESTS_REQUIRE, 'test': TESTS_REQUIRE,
'testing': TESTS_REQUIRE + ['nose', 'coverage'],
}, },
test_suite="persistent.tests", test_suite="persistent.tests",
install_requires=[ install_requires=[
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment