Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
isaak yansane-sisk
slapos.buildout
Commits
58229802
Commit
58229802
authored
Jun 28, 2006
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug that caused dependency tests to be run.
parent
8ec1c010
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
13 deletions
+54
-13
testrunnerrecipe/src/zc/recipe/testrunner/README.txt
testrunnerrecipe/src/zc/recipe/testrunner/README.txt
+48
-11
testrunnerrecipe/src/zc/recipe/testrunner/__init__.py
testrunnerrecipe/src/zc/recipe/testrunner/__init__.py
+6
-2
No files found.
testrunnerrecipe/src/zc/recipe/testrunner/README.txt
View file @
58229802
...
...
@@ -24,16 +24,18 @@ To illustrate this, we'll create a pair of projects in our sample
buildout:
>>> mkdir(sample_buildout, 'demo')
>>> write(sample_buildout, 'demo', 'tests.py',
>>> mkdir(sample_buildout, 'demo', 'demo')
>>> write(sample_buildout, 'demo', 'demo', '__init__.py', '')
>>> write(sample_buildout, 'demo', 'demo', 'tests.py',
... '''
... import unittest
...
... class Test
Something
(unittest.TestCase):
... def test
_something
(self):
... class Test
Demo
(unittest.TestCase):
... def test(self):
... pass
...
... def test_suite():
... return unittest.makeSuite(Test
Something
)
... return unittest.makeSuite(Test
Demo
)
... ''')
>>> write(sample_buildout, 'demo', 'setup.py',
...
...
@@ -46,34 +48,62 @@ buildout:
>>> write(sample_buildout, 'demo', 'README.txt', '')
>>> mkdir(sample_buildout, 'demo2')
>>> write(sample_buildout, 'demo2', 'tests.py',
>>> mkdir(sample_buildout, 'demo2', 'demo2')
>>> write(sample_buildout, 'demo2', 'demo2', '__init__.py', '')
>>> write(sample_buildout, 'demo2', 'demo2', 'tests.py',
... '''
... import unittest
...
... class
TestSomething
(unittest.TestCase):
... def test
_something
(self):
... class
Demo2Tests
(unittest.TestCase):
... def test
2
(self):
... pass
...
... def test_suite():
... return unittest.makeSuite(
TestSomething
)
... return unittest.makeSuite(
Demo2Tests
)
... ''')
>>> write(sample_buildout, 'demo2', 'setup.py',
... """
... from setuptools import setup
...
... setup(name = "demo2")
... setup(name = "demo2"
, install_requires= ['demoneeded']
)
... """)
>>> write(sample_buildout, 'demo2', 'README.txt', '')
Demo 2 depends on demoneeded:
>>> mkdir(sample_buildout, 'demoneeded')
>>> mkdir(sample_buildout, 'demoneeded', 'demoneeded')
>>> write(sample_buildout, 'demoneeded', 'demoneeded', '__init__.py', '')
>>> write(sample_buildout, 'demoneeded', 'demoneeded', 'tests.py',
... '''
... import unittest
...
... class TestNeeded(unittest.TestCase):
... def test_needed(self):
... pass
...
... def test_suite():
... return unittest.makeSuite(TestNeeded)
... ''')
>>> write(sample_buildout, 'demoneeded', 'setup.py',
... """
... from setuptools import setup
...
... setup(name = "demoneeded")
... """)
>>> write(sample_buildout, 'demoneeded', 'README.txt', '')
We'll update our buildout to install the demo project as a
develop egg and to create the test script:
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = demo demo2
... develop = demo demo
needed demo
2
... parts = testdemo
... offline = true
...
...
...
@@ -104,10 +134,17 @@ We get a test script installed in our bin directory:
We can run the test script to run our demo test:
>>> print system(os.path.join(sample_buildout, 'bin', 'test')),
>>> print system(os.path.join(sample_buildout, 'bin', 'test') + ' -vv'),
Running tests at level 1
Running unit tests:
Running:
test (demo.tests.TestDemo)
test2 (demo2.tests.Demo2Tests)
Ran 2 tests with 0 failures and 0 errors in 0.000 seconds.
Note that we didn't run the demoneeded tests. Tests are only run for
the distributions listed, not for their dependencies.
If we leave the script option out of the configuration, then the test
script will get it's name from the part:
...
...
testrunnerrecipe/src/zc/recipe/testrunner/__init__.py
View file @
58229802
...
...
@@ -40,15 +40,19 @@ class TestRunner:
requirements
=
[
r
.
strip
()
for
r
in
options
[
'distributions'
].
split
(
'
\
n
'
)
if
r
.
strip
()]
ws
=
zc
.
buildout
.
easy_install
.
working_set
(
requirements
+
[
'zope.testing'
],
executable
=
options
[
'executable'
],
path
=
[
options
[
'_d'
],
options
[
'_e'
]]
)
path
=
[
dist
.
location
for
dist
in
ws
]
project_names
=
[
pkg_resources
.
Requirement
.
parse
(
r
).
project_name
for
r
in
requirements
]
locations
=
[
dist
.
location
for
dist
in
ws
if
dist
.
project_name
!=
'zope.testing'
]
if
dist
.
project_name
in
project_names
]
script
=
options
[
'script'
]
open
(
script
,
'w'
).
write
(
tests_template
%
dict
(
...
...
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