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
Łukasz Nowak
slapos.buildout
Commits
e8622c2c
Commit
e8622c2c
authored
Jun 12, 2006
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored tests to avoid duplication.
parent
6f0b45a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
99 deletions
+49
-99
eggrecipe/src/zc/recipe/egg/tests.py
eggrecipe/src/zc/recipe/egg/tests.py
+2
-45
src/zc/buildout/testing.py
src/zc/buildout/testing.py
+45
-5
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+2
-49
No files found.
eggrecipe/src/zc/recipe/egg/tests.py
View file @
e8622c2c
...
@@ -12,26 +12,12 @@
...
@@ -12,26 +12,12 @@
#
#
##############################################################################
##############################################################################
import
os
,
re
,
shutil
,
sys
,
tempfile
import
os
,
re
,
shutil
,
sys
import
pkg_resources
import
zc.buildout.testing
import
zc.buildout.testing
import
unittest
import
unittest
from
zope.testing
import
doctest
,
renormalizing
from
zope.testing
import
doctest
,
renormalizing
def
runsetup
(
d
):
here
=
os
.
getcwd
()
try
:
os
.
chdir
(
d
)
os
.
spawnle
(
os
.
P_WAIT
,
sys
.
executable
,
sys
.
executable
,
'setup.py'
,
'-q'
,
'bdist_egg'
,
{
'PYTHONPATH'
:
os
.
path
.
dirname
(
pkg_resources
.
__file__
)},
)
shutil
.
rmtree
(
'build'
)
finally
:
os
.
chdir
(
here
)
def
dirname
(
d
,
level
=
1
):
def
dirname
(
d
,
level
=
1
):
if
level
==
0
:
if
level
==
0
:
return
d
return
d
...
@@ -42,36 +28,7 @@ def setUp(test):
...
@@ -42,36 +28,7 @@ def setUp(test):
open
(
os
.
path
.
join
(
test
.
globs
[
'sample_buildout'
],
open
(
os
.
path
.
join
(
test
.
globs
[
'sample_buildout'
],
'eggs'
,
'zc.recipe.egg.egg-link'
),
'eggs'
,
'zc.recipe.egg.egg-link'
),
'w'
).
write
(
dirname
(
__file__
,
4
))
'w'
).
write
(
dirname
(
__file__
,
4
))
zc
.
buildout
.
testing
.
create_sample_eggs
(
test
)
sample
=
tempfile
.
mkdtemp
(
'eggtest'
)
test
.
globs
[
'_sample_eggs_container'
]
=
sample
test
.
globs
[
'sample_eggs'
]
=
os
.
path
.
join
(
sample
,
'dist'
)
zc
.
buildout
.
testing
.
write
(
sample
,
'README.txt'
,
''
)
zc
.
buildout
.
testing
.
write
(
sample
,
'eggrecipedemobeeded.py'
,
'y=1
\
n
'
)
zc
.
buildout
.
testing
.
write
(
sample
,
'setup.py'
,
"from setuptools import setup
\
n
"
"setup(name='demoneeded', py_modules=['eggrecipedemobeeded'],"
" zip_safe=True, version='1.0')
\
n
"
)
runsetup
(
sample
)
os
.
remove
(
os
.
path
.
join
(
sample
,
'eggrecipedemobeeded.py'
))
for
i
in
(
1
,
2
,
3
):
zc
.
buildout
.
testing
.
write
(
sample
,
'eggrecipedemo.py'
,
'import eggrecipedemobeeded
\
n
'
'x=%s
\
n
'
'def main(): print x, eggrecipedemobeeded.y
\
n
'
%
i
)
zc
.
buildout
.
testing
.
write
(
sample
,
'setup.py'
,
"from setuptools import setup
\
n
"
"setup(name='demo', py_modules=['eggrecipedemo'],"
" install_requires = 'demoneeded',"
" entry_points={'console_scripts': ['demo = eggrecipedemo:main']},"
" zip_safe=True, version='0.%s')
\
n
"
%
i
)
runsetup
(
sample
)
def
tearDown
(
test
):
def
tearDown
(
test
):
shutil
.
rmtree
(
test
.
globs
[
'_sample_eggs_container'
])
shutil
.
rmtree
(
test
.
globs
[
'_sample_eggs_container'
])
...
...
src/zc/buildout/testing.py
View file @
e8622c2c
...
@@ -18,6 +18,7 @@ $Id$
...
@@ -18,6 +18,7 @@ $Id$
import
os
,
re
,
shutil
,
sys
,
tempfile
,
unittest
import
os
,
re
,
shutil
,
sys
,
tempfile
,
unittest
from
zope.testing
import
doctest
,
renormalizing
from
zope.testing
import
doctest
,
renormalizing
import
pkg_resources
def
cat
(
dir
,
*
names
):
def
cat
(
dir
,
*
names
):
...
@@ -51,11 +52,6 @@ def system(command, input=''):
...
@@ -51,11 +52,6 @@ def system(command, input=''):
i
.
close
()
i
.
close
()
return
o
.
read
()
return
o
.
read
()
def
dirname
(
path
,
n
=
1
):
if
n
<=
0
:
return
path
return
dirname
(
os
.
path
.
dirname
(
path
),
n
-
1
)
def
buildoutSetUp
(
test
):
def
buildoutSetUp
(
test
):
sample
=
tempfile
.
mkdtemp
(
'buildout-tests'
)
sample
=
tempfile
.
mkdtemp
(
'buildout-tests'
)
for
name
in
(
'bin'
,
'eggs'
,
'parts'
):
for
name
in
(
'bin'
,
'eggs'
,
'parts'
):
...
@@ -107,3 +103,47 @@ sys.path[0:0] = %(path)r
...
@@ -107,3 +103,47 @@ sys.path[0:0] = %(path)r
from pkg_resources import load_entry_point
from pkg_resources import load_entry_point
sys.exit(load_entry_point('zc.buildout', 'console_scripts', 'buildout')())
sys.exit(load_entry_point('zc.buildout', 'console_scripts', 'buildout')())
'''
'''
def
runsetup
(
d
):
here
=
os
.
getcwd
()
try
:
os
.
chdir
(
d
)
os
.
spawnle
(
os
.
P_WAIT
,
sys
.
executable
,
sys
.
executable
,
'setup.py'
,
'-q'
,
'bdist_egg'
,
{
'PYTHONPATH'
:
os
.
path
.
dirname
(
pkg_resources
.
__file__
)},
)
shutil
.
rmtree
(
'build'
)
finally
:
os
.
chdir
(
here
)
def
create_sample_eggs
(
test
):
sample
=
tempfile
.
mkdtemp
(
'eggtest'
)
test
.
globs
[
'_sample_eggs_container'
]
=
sample
test
.
globs
[
'sample_eggs'
]
=
os
.
path
.
join
(
sample
,
'dist'
)
write
(
sample
,
'README.txt'
,
''
)
write
(
sample
,
'eggrecipedemobeeded.py'
,
'y=1
\
n
'
)
write
(
sample
,
'setup.py'
,
"from setuptools import setup
\
n
"
"setup(name='demoneeded', py_modules=['eggrecipedemobeeded'],"
" zip_safe=True, version='1.0')
\
n
"
)
runsetup
(
sample
)
os
.
remove
(
os
.
path
.
join
(
sample
,
'eggrecipedemobeeded.py'
))
for
i
in
(
1
,
2
,
3
):
write
(
sample
,
'eggrecipedemo.py'
,
'import eggrecipedemobeeded
\
n
'
'x=%s
\
n
'
'def main(): print x, eggrecipedemobeeded.y
\
n
'
%
i
)
write
(
sample
,
'setup.py'
,
"from setuptools import setup
\
n
"
"setup(name='demo', py_modules=['eggrecipedemo'],"
" install_requires = 'demoneeded',"
" entry_points={'console_scripts': ['demo = eggrecipedemo:main']},"
" zip_safe=True, version='0.%s')
\
n
"
%
i
)
runsetup
(
sample
)
src/zc/buildout/tests.py
View file @
e8622c2c
...
@@ -16,9 +16,8 @@
...
@@ -16,9 +16,8 @@
$Id$
$Id$
"""
"""
import
os
,
re
,
shutil
,
sys
,
tempfile
,
unittest
import
os
,
re
,
shutil
,
sys
,
unittest
from
zope.testing
import
doctest
,
renormalizing
from
zope.testing
import
doctest
,
renormalizing
import
pkg_resources
import
zc.buildout.testing
import
zc.buildout.testing
def
buildout_error_handling
():
def
buildout_error_handling
():
...
@@ -64,55 +63,9 @@ It is an error to create a variable-reference cycle:
...
@@ -64,55 +63,9 @@ It is an error to create a variable-reference cycle:
'''
'''
def
runsetup
(
d
):
here
=
os
.
getcwd
()
try
:
os
.
chdir
(
d
)
os
.
spawnle
(
os
.
P_WAIT
,
sys
.
executable
,
sys
.
executable
,
'setup.py'
,
'-q'
,
'bdist_egg'
,
{
'PYTHONPATH'
:
os
.
path
.
dirname
(
pkg_resources
.
__file__
)},
)
shutil
.
rmtree
(
'build'
)
finally
:
os
.
chdir
(
here
)
def
dirname
(
d
,
level
=
1
):
if
level
==
0
:
return
d
return
dirname
(
os
.
path
.
dirname
(
d
),
level
-
1
)
def
linkerSetUp
(
test
):
def
linkerSetUp
(
test
):
zc
.
buildout
.
testing
.
buildoutSetUp
(
test
)
zc
.
buildout
.
testing
.
buildoutSetUp
(
test
)
sample
=
tempfile
.
mkdtemp
(
'eggtest'
)
zc
.
buildout
.
testing
.
create_sample_eggs
(
test
)
test
.
globs
[
'_sample_eggs_container'
]
=
sample
test
.
globs
[
'sample_eggs'
]
=
os
.
path
.
join
(
sample
,
'dist'
)
zc
.
buildout
.
testing
.
write
(
sample
,
'README.txt'
,
''
)
zc
.
buildout
.
testing
.
write
(
sample
,
'eggrecipedemobeeded.py'
,
'y=1
\
n
'
)
zc
.
buildout
.
testing
.
write
(
sample
,
'setup.py'
,
"from setuptools import setup
\
n
"
"setup(name='demoneeded', py_modules=['eggrecipedemobeeded'],"
" zip_safe=True, version='1.0')
\
n
"
)
runsetup
(
sample
)
os
.
remove
(
os
.
path
.
join
(
sample
,
'eggrecipedemobeeded.py'
))
for
i
in
(
1
,
2
,
3
):
zc
.
buildout
.
testing
.
write
(
sample
,
'eggrecipedemo.py'
,
'import eggrecipedemobeeded
\
n
'
'x=%s
\
n
'
'def main(): print x, eggrecipedemobeeded.y
\
n
'
%
i
)
zc
.
buildout
.
testing
.
write
(
sample
,
'setup.py'
,
"from setuptools import setup
\
n
"
"setup(name='demo', py_modules=['eggrecipedemo'],"
" install_requires = 'demoneeded',"
" entry_points={'console_scripts': ['demo = eggrecipedemo:main']},"
" zip_safe=True, version='0.%s')
\
n
"
%
i
)
runsetup
(
sample
)
def
linkerTearDown
(
test
):
def
linkerTearDown
(
test
):
shutil
.
rmtree
(
test
.
globs
[
'_sample_eggs_container'
])
shutil
.
rmtree
(
test
.
globs
[
'_sample_eggs_container'
])
...
...
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