Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
persistent
Commits
049bbb82
Commit
049bbb82
authored
May 14, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'setup.py dev' alias
- Installs 'nose' and 'coverage'.
parent
262899e7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
19 deletions
+22
-19
CHANGES.txt
CHANGES.txt
+2
-0
persistent/tests/persistent.txt
persistent/tests/persistent.txt
+7
-18
persistent/tests/test_persistent.py
persistent/tests/test_persistent.py
+1
-1
setup.cfg
setup.cfg
+11
-0
setup.py
setup.py
+1
-0
No files found.
CHANGES.txt
View file @
049bbb82
...
...
@@ -4,6 +4,8 @@
4.0 (unreleased)
-----------------
- Added ``setup.py dev`` alias (installs ``nose`` and ``coverage``).
- Dropped dependency on ``zope.testing`` / ``zope.testrunner``: tests now
run with ``setup.py test``.
...
...
persistent/tests/persistent.txt
View file @
049bbb82
...
...
@@ -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
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
loading and storing the state of a persistent object. It's stored in
the ``_p_jar`` attribute of a persistent object.
...
...
@@ -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
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_oid = 1
>>> p._p_jar = BrokenDM()
...
...
persistent/tests/test_persistent.py
View file @
049bbb82
...
...
@@ -52,6 +52,6 @@ if simple_new is not None:
def
test_suite
():
import
doctest
return
unittest
.
TestSuite
((
doctest
.
DocFileSuite
(
"persistent.txt"
,
globs
=
{
"P"
:
P
}
),
doctest
.
DocFileSuite
(
"persistent.txt"
),
doctest
.
DocTestSuite
(),
))
setup.cfg
0 → 100644
View file @
049bbb82
[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]
setup.py
View file @
049bbb82
...
...
@@ -80,6 +80,7 @@ setup(name='persistent',
tests_require
=
TESTS_REQUIRE
,
extras_require
=
{
'test'
:
TESTS_REQUIRE
,
'testing'
:
TESTS_REQUIRE
+
[
'nose'
,
'coverage'
],
},
test_suite
=
"persistent.tests"
,
install_requires
=
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment