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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.buildout
Commits
7dcd35c5
Commit
7dcd35c5
authored
May 08, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a unittest that can be run indepedent of buildout isolation.
'python -m zc.buildout.tests TestEasyInstall'
parent
1167e212
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
0 deletions
+118
-0
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+118
-0
No files found.
src/zc/buildout/tests.py
View file @
7dcd35c5
...
...
@@ -12,6 +12,9 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from
__future__
import
print_function
import
unittest
from
zc.buildout.buildout
import
print_
from
zope.testing
import
renormalizing
,
setupstack
...
...
@@ -35,6 +38,116 @@ if os_path_sep == '\\':
os_path_sep
*=
2
class
TestEasyInstall
(
unittest
.
TestCase
):
# The contents of a zipped egg, created by setuptools:
# from setuptools import setup
# setup(
# name='TheProject',
# version='3.3',
# )
#
# (we can't run setuptools at runtime, it may not be installed)
EGG_DATA
=
(
b'PK
\
x03
\
x04
\
x14
\
x00
\
x00
\
x00
\
x08
\
x00
q8
\
xa8
Lg0
\
xb7
ix
\
x00
\
x00
\
x00
\
xb6
\
x00
'
b'
\
x00
\
x00
\
x11
\
x00
\
x00
\
x00
EGG-INFO/PKG-INFO
\
xf3
M-ILI,I
\
xd4
\
r
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00
\
x00
\
x00
\
x01
'
b'
\
x00
\
x00
\
x00
\
x1d
\
x00
\
x00
\
x00
EGG-INFO/dependency_links.txt
\
xe3
\
x02
\
x00
P'
b'K
\
x03
\
x04
\
x14
\
x00
\
x00
\
x00
\
x08
\
x00
q8
\
xa8
L
\
x93
\
x06
\
xd7
2
\
x03
\
x00
\
x00
'
b'
\
x00
\
x01
\
x00
\
x00
\
x00
\
x16
\
x00
\
x00
\
x00
EGG-INFO/top_level.txt
\
xe3
\
x02
\
x00
PK'
b'
\
x03
\
x04
\
x14
\
x00
\
x00
\
x00
\
x08
\
x00
q8
\
xa8
L
\
x93
\
x06
\
xd7
2
\
x03
\
x00
\
x00
\
x00
'
b'
\
x01
\
x00
\
x00
\
x00
\
x11
\
x00
\
x00
\
x00
EGG-INFO/zip-safe
\
xe3
\
x02
\
x00
PK
\
x01
\
x02
'
b'
\
x14
\
x03
\
x14
\
x00
\
x00
\
x00
\
x08
\
x00
q8
\
xa8
Lg0
\
xb7
ix
\
x00
\
x00
\
x00
\
xb6
\
x00
\
x00
\
x00
'
b'
\
x11
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
xa4
\
x81
\
x00
\
x00
\
x00
\
x00
EG'
b'G-INFO/PKG-INFOPK
\
x01
\
x02
\
x14
\
x03
\
x14
\
x00
\
x00
\
x00
\
x08
\
x00
q8
\
xa8
L61
\
xa1
XL'
b'
\
x00
\
x00
\
x00
\
x87
\
x00
\
x00
\
x00
\
x14
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
'
b'
\
x00
\
x00
\
x00
\
xa4
\
x81
\
xa7
\
x00
\
x00
\
x00
EGG-INFO/SOURCES.txtPK
\
x01
'
b'
\
x02
\
x14
\
x03
\
x14
\
x00
\
x00
\
x00
\
x08
\
x00
q8
\
xa8
L
\
x93
\
x06
\
xd7
2
\
x03
\
x00
\
x00
'
b'
\
x00
\
x01
\
x00
\
x00
\
x00
\
x1d
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
'
b'
\
x00
\
xa4
\
x81
%
\
x01
\
x00
\
x00
EGG-INFO/dependency_links.txtPK
\
x01
\
x02
'
b'
\
x14
\
x03
\
x14
\
x00
\
x00
\
x00
\
x08
\
x00
q8
\
xa8
L
\
x93
\
x06
\
xd7
2
\
x03
\
x00
\
x00
\
x00
'
b'
\
x01
\
x00
\
x00
\
x00
\
x16
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
'
b'
\
xa4
\
x81
c
\
x01
\
x00
\
x00
EGG-INFO/top_level.txtPK
\
x01
\
x02
\
x14
\
x03
\
x14
\
x00
'
b'
\
x00
\
x00
\
x08
\
x00
q8
\
xa8
L
\
x93
\
x06
\
xd7
2
\
x03
\
x00
\
x00
\
x00
\
x01
\
x00
\
x00
\
x00
'
b'
\
x11
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
xa4
\
x81
\
x9a
\
x01
\
x00
\
x00
EG'
b'G-INFO/zip-safePK
\
x05
\
x06
\
x00
\
x00
\
x00
\
x00
\
x05
\
x00
\
x05
\
x00
O
\
x01
\
x00
\
x00
\
xcc
'
b'
\
x01
\
x00
\
x00
\
x00
\
x00
'
)
def
setUp
(
self
):
self
.
cwd
=
os
.
getcwd
()
self
.
temp_dir
=
tempfile
.
mkdtemp
(
'.buildouttest'
)
self
.
project_dir
=
os
.
path
.
join
(
self
.
temp_dir
,
'TheProject'
)
self
.
project_dist_dir
=
os
.
path
.
join
(
self
.
temp_dir
,
'dist'
)
os
.
mkdir
(
self
.
project_dist_dir
)
self
.
egg_path
=
os
.
path
.
join
(
self
.
project_dist_dir
,
'TheProject.egg'
)
os
.
mkdir
(
self
.
project_dir
)
self
.
setup_path
=
os
.
path
.
join
(
self
.
project_dir
,
'setup.py'
)
os
.
chdir
(
self
.
temp_dir
)
def
tearDown
(
self
):
os
.
chdir
(
self
.
cwd
)
shutil
.
rmtree
(
self
.
temp_dir
)
def
_make_egg
(
self
):
with
open
(
self
.
egg_path
,
'wb'
)
as
f
:
f
.
write
(
self
.
EGG_DATA
)
def
_get_distro_and_egg_path
(
self
):
# Returns a distribution with a version of '3.3.0',
# but an egg with a version of '3.3'
self
.
_make_egg
()
from
distutils.dist
import
Distribution
dist
=
Distribution
()
dist
.
project_name
=
'TheProject'
dist
.
version
=
'3.3.0'
dist
.
parsed_version
=
pkg_resources
.
parse_version
(
dist
.
version
)
return
dist
,
self
.
egg_path
def
test_get_matching_dist_in_location_uses_parsed_version
(
self
):
# https://github.com/buildout/buildout/pull/452
# An egg built with the version '3.3' should match a distribution
# looking for '3.3.0'
dist
,
location
=
self
.
_get_distro_and_egg_path
()
result
=
zc
.
buildout
.
easy_install
.
_get_matching_dist_in_location
(
dist
,
self
.
project_dist_dir
)
self
.
assertIsNotNone
(
result
)
self
.
assertEqual
(
result
.
version
,
'3.3'
)
def
test_move_to_eggs_dir_and_compile
(
self
):
# https://github.com/buildout/buildout/pull/452
# An egg built with the version '3.3' should match a distribution
# looking for '3.3.0'
dist
,
location
=
self
.
_get_distro_and_egg_path
()
dist
.
location
=
location
dest
=
os
.
path
.
join
(
self
.
temp_dir
,
'NewLoc'
)
result
=
zc
.
buildout
.
easy_install
.
_move_to_eggs_dir_and_compile
(
dist
,
dest
)
self
.
assertIsNotNone
(
result
)
self
.
assertEqual
(
result
.
version
,
'3.3'
)
self
.
assertIn
(
dest
,
result
.
location
)
def
develop_w_non_setuptools_setup_scripts
():
"""
We should be able to deal with setup scripts that aren't setuptools based.
...
...
@@ -3788,4 +3901,9 @@ def test_suite():
]),
))
test_suite.append(unittest.defaultTestLoader.loadTestsFromName(__name__))
return unittest.TestSuite(test_suite)
if __name__ == '
__main__
':
unittest.main()
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