Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
0b41ce09
Commit
0b41ce09
authored
Jun 30, 2009
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert usage of fail* to assert*
parent
ae2382ce
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
106 additions
and
106 deletions
+106
-106
tests/test_archive_util.py
tests/test_archive_util.py
+8
-8
tests/test_bdist_rpm.py
tests/test_bdist_rpm.py
+2
-2
tests/test_bdist_wininst.py
tests/test_bdist_wininst.py
+1
-1
tests/test_build_clib.py
tests/test_build_clib.py
+1
-1
tests/test_build_ext.py
tests/test_build_ext.py
+15
-15
tests/test_build_py.py
tests/test_build_py.py
+3
-3
tests/test_build_scripts.py
tests/test_build_scripts.py
+5
-5
tests/test_clean.py
tests/test_clean.py
+1
-1
tests/test_cmd.py
tests/test_cmd.py
+1
-1
tests/test_config.py
tests/test_config.py
+2
-2
tests/test_config_cmd.py
tests/test_config_cmd.py
+2
-2
tests/test_dist.py
tests/test_dist.py
+21
-21
tests/test_install.py
tests/test_install.py
+8
-8
tests/test_install_data.py
tests/test_install_data.py
+6
-6
tests/test_install_lib.py
tests/test_install_lib.py
+3
-3
tests/test_install_scripts.py
tests/test_install_scripts.py
+7
-7
tests/test_msvc9compiler.py
tests/test_msvc9compiler.py
+2
-2
tests/test_register.py
tests/test_register.py
+8
-8
tests/test_sysconfig.py
tests/test_sysconfig.py
+6
-6
tests/test_upload.py
tests/test_upload.py
+2
-2
tests/test_util.py
tests/test_util.py
+2
-2
No files found.
tests/test_archive_util.py
View file @
0b41ce09
...
...
@@ -47,7 +47,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
# check if the compressed tarball was created
tarball
=
base_name
+
'.tar.gz'
self
.
assert
_
(
os
.
path
.
exists
(
tarball
))
self
.
assert
True
(
os
.
path
.
exists
(
tarball
))
# trying an uncompressed one
base_name
=
os
.
path
.
join
(
tmpdir2
,
'archive'
)
...
...
@@ -58,7 +58,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
finally
:
os
.
chdir
(
old_dir
)
tarball
=
base_name
+
'.tar'
self
.
assert
_
(
os
.
path
.
exists
(
tarball
))
self
.
assert
True
(
os
.
path
.
exists
(
tarball
))
def
_tarinfo
(
self
,
path
):
tar
=
tarfile
.
open
(
path
)
...
...
@@ -96,7 +96,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
# check if the compressed tarball was created
tarball
=
base_name
+
'.tar.gz'
self
.
assert
_
(
os
.
path
.
exists
(
tarball
))
self
.
assert
True
(
os
.
path
.
exists
(
tarball
))
# now create another tarball using `tar`
tarball2
=
os
.
path
.
join
(
tmpdir
,
'archive2.tar.gz'
)
...
...
@@ -110,7 +110,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
finally
:
os
.
chdir
(
old_dir
)
self
.
assert
_
(
os
.
path
.
exists
(
tarball2
))
self
.
assert
True
(
os
.
path
.
exists
(
tarball2
))
# let's compare both tarballs
self
.
assertEquals
(
self
.
_tarinfo
(
tarball
),
self
.
_tarinfo
(
tarball2
))
...
...
@@ -123,7 +123,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
finally
:
os
.
chdir
(
old_dir
)
tarball
=
base_name
+
'.tar'
self
.
assert
_
(
os
.
path
.
exists
(
tarball
))
self
.
assert
True
(
os
.
path
.
exists
(
tarball
))
# now for a dry_run
base_name
=
os
.
path
.
join
(
tmpdir2
,
'archive'
)
...
...
@@ -134,7 +134,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
finally
:
os
.
chdir
(
old_dir
)
tarball
=
base_name
+
'.tar'
self
.
assert
_
(
os
.
path
.
exists
(
tarball
))
self
.
assert
True
(
os
.
path
.
exists
(
tarball
))
@
unittest
.
skipUnless
(
find_executable
(
'compress'
),
'The compress program is required'
)
...
...
@@ -151,7 +151,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
finally
:
os
.
chdir
(
old_dir
)
tarball
=
base_name
+
'.tar.Z'
self
.
assert
_
(
os
.
path
.
exists
(
tarball
))
self
.
assert
True
(
os
.
path
.
exists
(
tarball
))
self
.
assertEquals
(
len
(
w
.
warnings
),
1
)
# same test with dry_run
...
...
@@ -165,7 +165,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
dry_run
=
True
)
finally
:
os
.
chdir
(
old_dir
)
self
.
assert
_
(
not
os
.
path
.
exists
(
tarball
))
self
.
assert
True
(
not
os
.
path
.
exists
(
tarball
))
self
.
assertEquals
(
len
(
w
.
warnings
),
1
)
@
unittest
.
skipUnless
(
ZIP_SUPPORT
,
'Need zip support to run'
)
...
...
tests/test_bdist_rpm.py
View file @
0b41ce09
...
...
@@ -74,7 +74,7 @@ class BuildRpmTestCase(support.TempdirManager,
cmd
.
run
()
dist_created
=
os
.
listdir
(
os
.
path
.
join
(
pkg_dir
,
'dist'
))
self
.
assert
_
(
'foo-0.1-1.noarch.rpm'
in
dist_created
)
self
.
assert
True
(
'foo-0.1-1.noarch.rpm'
in
dist_created
)
def
test_no_optimize_flag
(
self
):
...
...
@@ -114,7 +114,7 @@ class BuildRpmTestCase(support.TempdirManager,
cmd
.
run
()
dist_created
=
os
.
listdir
(
os
.
path
.
join
(
pkg_dir
,
'dist'
))
self
.
assert
_
(
'foo-0.1-1.noarch.rpm'
in
dist_created
)
self
.
assert
True
(
'foo-0.1-1.noarch.rpm'
in
dist_created
)
os
.
remove
(
os
.
path
.
join
(
pkg_dir
,
'dist'
,
'foo-0.1-1.noarch.rpm'
))
def
test_suite
():
...
...
tests/test_bdist_wininst.py
View file @
0b41ce09
...
...
@@ -21,7 +21,7 @@ class BuildWinInstTestCase(support.TempdirManager,
# and make sure it finds it and returns its content
# no matter what platform we have
exe_file
=
cmd
.
get_exe_bytes
()
self
.
assert
_
(
len
(
exe_file
)
>
10
)
self
.
assert
True
(
len
(
exe_file
)
>
10
)
def
test_suite
():
return
unittest
.
makeSuite
(
BuildWinInstTestCase
)
...
...
tests/test_build_clib.py
View file @
0b41ce09
...
...
@@ -135,7 +135,7 @@ class BuildCLibTestCase(support.TempdirManager,
cmd
.
run
()
# let's check the result
self
.
assert
_
(
'libfoo.a'
in
os
.
listdir
(
build_temp
))
self
.
assert
True
(
'libfoo.a'
in
os
.
listdir
(
build_temp
))
def
test_suite
():
return
unittest
.
makeSuite
(
BuildCLibTestCase
)
...
...
tests/test_build_ext.py
View file @
0b41ce09
...
...
@@ -73,15 +73,15 @@ class BuildExtTestCase(support.TempdirManager,
import
xx
for
attr
in
(
'error'
,
'foo'
,
'new'
,
'roj'
):
self
.
assert
_
(
hasattr
(
xx
,
attr
))
self
.
assert
True
(
hasattr
(
xx
,
attr
))
self
.
assertEquals
(
xx
.
foo
(
2
,
5
),
7
)
self
.
assertEquals
(
xx
.
foo
(
13
,
15
),
28
)
self
.
assertEquals
(
xx
.
new
().
demo
(),
None
)
doc
=
'This is a template module just for instruction.'
self
.
assertEquals
(
xx
.
__doc__
,
doc
)
self
.
assert
_
(
isinstance
(
xx
.
Null
(),
xx
.
Null
))
self
.
assert
_
(
isinstance
(
xx
.
Str
(),
xx
.
Str
))
self
.
assert
True
(
isinstance
(
xx
.
Null
(),
xx
.
Null
))
self
.
assert
True
(
isinstance
(
xx
.
Str
(),
xx
.
Str
))
def
tearDown
(
self
):
# Get everything back to normal
...
...
@@ -114,7 +114,7 @@ class BuildExtTestCase(support.TempdirManager,
_config_vars
[
'Py_ENABLE_SHARED'
]
=
old_var
# make sure we get some library dirs under solaris
self
.
assert
_
(
len
(
cmd
.
library_dirs
)
>
0
)
self
.
assert
True
(
len
(
cmd
.
library_dirs
)
>
0
)
def
test_user_site
(
self
):
# site.USER_SITE was introduced in 2.6
...
...
@@ -128,7 +128,7 @@ class BuildExtTestCase(support.TempdirManager,
# making sure the user option is there
options
=
[
name
for
name
,
short
,
lable
in
cmd
.
user_options
]
self
.
assert
_
(
'user'
in
options
)
self
.
assert
True
(
'user'
in
options
)
# setting a value
cmd
.
user
=
1
...
...
@@ -144,9 +144,9 @@ class BuildExtTestCase(support.TempdirManager,
# see if include_dirs and library_dirs
# were set
self
.
assert
_
(
lib
in
cmd
.
library_dirs
)
self
.
assert
_
(
lib
in
cmd
.
rpath
)
self
.
assert
_
(
incl
in
cmd
.
include_dirs
)
self
.
assert
True
(
lib
in
cmd
.
library_dirs
)
self
.
assert
True
(
lib
in
cmd
.
rpath
)
self
.
assert
True
(
incl
in
cmd
.
include_dirs
)
def
test_optional_extension
(
self
):
...
...
@@ -175,10 +175,10 @@ class BuildExtTestCase(support.TempdirManager,
from
distutils
import
sysconfig
py_include
=
sysconfig
.
get_python_inc
()
self
.
assert
_
(
py_include
in
cmd
.
include_dirs
)
self
.
assert
True
(
py_include
in
cmd
.
include_dirs
)
plat_py_include
=
sysconfig
.
get_python_inc
(
plat_specific
=
1
)
self
.
assert
_
(
plat_py_include
in
cmd
.
include_dirs
)
self
.
assert
True
(
plat_py_include
in
cmd
.
include_dirs
)
# make sure cmd.libraries is turned into a list
# if it's a string
...
...
@@ -192,7 +192,7 @@ class BuildExtTestCase(support.TempdirManager,
cmd
=
build_ext
(
dist
)
cmd
.
library_dirs
=
'my_lib_dir'
cmd
.
finalize_options
()
self
.
assert
_
(
'my_lib_dir'
in
cmd
.
library_dirs
)
self
.
assert
True
(
'my_lib_dir'
in
cmd
.
library_dirs
)
# make sure rpath is turned into a list
# if it's a list of os.pathsep's paths
...
...
@@ -257,13 +257,13 @@ class BuildExtTestCase(support.TempdirManager,
'some'
:
'bar'
})]
cmd
.
check_extensions_list
(
exts
)
ext
=
exts
[
0
]
self
.
assert
_
(
isinstance
(
ext
,
Extension
))
self
.
assert
True
(
isinstance
(
ext
,
Extension
))
# check_extensions_list adds in ext the values passed
# when they are in ('include_dirs', 'library_dirs', 'libraries'
# 'extra_objects', 'extra_compile_args', 'extra_link_args')
self
.
assertEquals
(
ext
.
libraries
,
'foo'
)
self
.
assert
_
(
not
hasattr
(
ext
,
'some'
))
self
.
assert
True
(
not
hasattr
(
ext
,
'some'
))
# 'macros' element of build info dict must be 1- or 2-tuple
exts
=
[(
'foo.bar'
,
{
'sources'
:
[
''
],
'libraries'
:
'foo'
,
...
...
@@ -321,7 +321,7 @@ class BuildExtTestCase(support.TempdirManager,
so_file
=
cmd
.
get_outputs
()[
0
]
finally
:
os
.
chdir
(
old_wd
)
self
.
assert
_
(
os
.
path
.
exists
(
so_file
))
self
.
assert
True
(
os
.
path
.
exists
(
so_file
))
self
.
assertEquals
(
os
.
path
.
splitext
(
so_file
)[
-
1
],
sysconfig
.
get_config_var
(
'SO'
))
so_dir
=
os
.
path
.
dirname
(
so_file
)
...
...
@@ -330,7 +330,7 @@ class BuildExtTestCase(support.TempdirManager,
cmd
.
inplace
=
0
cmd
.
run
()
so_file
=
cmd
.
get_outputs
()[
0
]
self
.
assert
_
(
os
.
path
.
exists
(
so_file
))
self
.
assert
True
(
os
.
path
.
exists
(
so_file
))
self
.
assertEquals
(
os
.
path
.
splitext
(
so_file
)[
-
1
],
sysconfig
.
get_config_var
(
'SO'
))
so_dir
=
os
.
path
.
dirname
(
so_file
)
...
...
tests/test_build_py.py
View file @
0b41ce09
...
...
@@ -52,9 +52,9 @@ class BuildPyTestCase(support.TempdirManager,
self
.
assertEqual
(
len
(
cmd
.
get_outputs
()),
3
)
pkgdest
=
os
.
path
.
join
(
destination
,
"pkg"
)
files
=
os
.
listdir
(
pkgdest
)
self
.
assert
_
(
"__init__.py"
in
files
)
self
.
assert
_
(
"__init__.pyc"
in
files
)
self
.
assert
_
(
"README.txt"
in
files
)
self
.
assert
True
(
"__init__.py"
in
files
)
self
.
assert
True
(
"__init__.pyc"
in
files
)
self
.
assert
True
(
"README.txt"
in
files
)
def
test_empty_package_dir
(
self
):
# See SF 1668596/1720897.
...
...
tests/test_build_scripts.py
View file @
0b41ce09
...
...
@@ -16,12 +16,12 @@ class BuildScriptsTestCase(support.TempdirManager,
def
test_default_settings
(
self
):
cmd
=
self
.
get_build_scripts_cmd
(
"/foo/bar"
,
[])
self
.
assert
_
(
not
cmd
.
force
)
self
.
assert
_
(
cmd
.
build_dir
is
None
)
self
.
assert
True
(
not
cmd
.
force
)
self
.
assert
True
(
cmd
.
build_dir
is
None
)
cmd
.
finalize_options
()
self
.
assert
_
(
cmd
.
force
)
self
.
assert
True
(
cmd
.
force
)
self
.
assertEqual
(
cmd
.
build_dir
,
"/foo/bar"
)
def
test_build
(
self
):
...
...
@@ -37,7 +37,7 @@ class BuildScriptsTestCase(support.TempdirManager,
built
=
os
.
listdir
(
target
)
for
name
in
expected
:
self
.
assert
_
(
name
in
built
)
self
.
assert
True
(
name
in
built
)
def
get_build_scripts_cmd
(
self
,
target
,
scripts
):
import
sys
...
...
@@ -100,7 +100,7 @@ class BuildScriptsTestCase(support.TempdirManager,
built
=
os
.
listdir
(
target
)
for
name
in
expected
:
self
.
assert
_
(
name
in
built
)
self
.
assert
True
(
name
in
built
)
def
test_suite
():
return
unittest
.
makeSuite
(
BuildScriptsTestCase
)
...
...
tests/test_clean.py
View file @
0b41ce09
...
...
@@ -35,7 +35,7 @@ class cleanTestCase(support.TempdirManager,
# make sure the files where removed
for
name
,
path
in
dirs
:
self
.
assert
_
(
not
os
.
path
.
exists
(
path
),
self
.
assert
True
(
not
os
.
path
.
exists
(
path
),
'%s was not removed'
%
path
)
# let's run the command again (should spit warnings but suceed)
...
...
tests/test_cmd.py
View file @
0b41ce09
...
...
@@ -70,7 +70,7 @@ class CommandTestCase(unittest.TestCase):
cmd
.
option2
=
None
cmd
.
ensure_string
(
'option2'
,
'xxx'
)
self
.
assert
_
(
hasattr
(
cmd
,
'option2'
))
self
.
assert
True
(
hasattr
(
cmd
,
'option2'
))
cmd
.
option3
=
1
self
.
assertRaises
(
DistutilsOptionError
,
cmd
.
ensure_string
,
'option3'
)
...
...
tests/test_config.py
View file @
0b41ce09
...
...
@@ -105,9 +105,9 @@ class PyPIRCCommandTestCase(support.TempdirManager,
def
test_server_empty_registration
(
self
):
cmd
=
self
.
_cmd
(
self
.
dist
)
rc
=
cmd
.
_get_rc_file
()
self
.
assert
_
(
not
os
.
path
.
exists
(
rc
))
self
.
assert
True
(
not
os
.
path
.
exists
(
rc
))
cmd
.
_store_pypirc
(
'tarek'
,
'xxx'
)
self
.
assert
_
(
os
.
path
.
exists
(
rc
))
self
.
assert
True
(
os
.
path
.
exists
(
rc
))
content
=
open
(
rc
).
read
()
self
.
assertEquals
(
content
,
WANTED
)
...
...
tests/test_config_cmd.py
View file @
0b41ce09
...
...
@@ -73,14 +73,14 @@ class ConfigTestCase(support.LoggingSilencer,
self
.
write_file
(
f2
,
'xxx'
)
for
f
in
(
f1
,
f2
):
self
.
assert
_
(
os
.
path
.
exists
(
f
))
self
.
assert
True
(
os
.
path
.
exists
(
f
))
pkg_dir
,
dist
=
self
.
create_dist
()
cmd
=
config
(
dist
)
cmd
.
_clean
(
f1
,
f2
)
for
f
in
(
f1
,
f2
):
self
.
assert
_
(
not
os
.
path
.
exists
(
f
))
self
.
assert
True
(
not
os
.
path
.
exists
(
f
))
def
test_suite
():
return
unittest
.
makeSuite
(
ConfigTestCase
)
...
...
tests/test_dist.py
View file @
0b41ce09
...
...
@@ -73,7 +73,7 @@ class DistributionTestCase(support.TempdirManager,
self
.
assertEqual
(
d
.
get_command_packages
(),
[
"distutils.command"
,
"foo.bar"
,
"distutils.tests"
])
cmd
=
d
.
get_command_obj
(
"test_dist"
)
self
.
assert
_
(
isinstance
(
cmd
,
test_dist
))
self
.
assert
True
(
isinstance
(
cmd
,
test_dist
))
self
.
assertEqual
(
cmd
.
sample_option
,
"sometext"
)
def
test_command_packages_configfile
(
self
):
...
...
@@ -204,10 +204,10 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
"version"
:
"1.0"
}
dist
=
Distribution
(
attrs
)
meta
=
self
.
format_metadata
(
dist
)
self
.
assert
_
(
"Metadata-Version: 1.0"
in
meta
)
self
.
assert
_
(
"provides:"
not
in
meta
.
lower
())
self
.
assert
_
(
"requires:"
not
in
meta
.
lower
())
self
.
assert
_
(
"obsoletes:"
not
in
meta
.
lower
())
self
.
assert
True
(
"Metadata-Version: 1.0"
in
meta
)
self
.
assert
True
(
"provides:"
not
in
meta
.
lower
())
self
.
assert
True
(
"requires:"
not
in
meta
.
lower
())
self
.
assert
True
(
"obsoletes:"
not
in
meta
.
lower
())
def
test_provides
(
self
):
attrs
=
{
"name"
:
"package"
,
...
...
@@ -219,9 +219,9 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
self
.
assertEqual
(
dist
.
get_provides
(),
[
"package"
,
"package.sub"
])
meta
=
self
.
format_metadata
(
dist
)
self
.
assert
_
(
"Metadata-Version: 1.1"
in
meta
)
self
.
assert
_
(
"requires:"
not
in
meta
.
lower
())
self
.
assert
_
(
"obsoletes:"
not
in
meta
.
lower
())
self
.
assert
True
(
"Metadata-Version: 1.1"
in
meta
)
self
.
assert
True
(
"requires:"
not
in
meta
.
lower
())
self
.
assert
True
(
"obsoletes:"
not
in
meta
.
lower
())
def
test_provides_illegal
(
self
):
self
.
assertRaises
(
ValueError
,
Distribution
,
...
...
@@ -239,11 +239,11 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
self
.
assertEqual
(
dist
.
get_requires
(),
[
"other"
,
"another (==1.0)"
])
meta
=
self
.
format_metadata
(
dist
)
self
.
assert
_
(
"Metadata-Version: 1.1"
in
meta
)
self
.
assert
_
(
"provides:"
not
in
meta
.
lower
())
self
.
assert
_
(
"Requires: other"
in
meta
)
self
.
assert
_
(
"Requires: another (==1.0)"
in
meta
)
self
.
assert
_
(
"obsoletes:"
not
in
meta
.
lower
())
self
.
assert
True
(
"Metadata-Version: 1.1"
in
meta
)
self
.
assert
True
(
"provides:"
not
in
meta
.
lower
())
self
.
assert
True
(
"Requires: other"
in
meta
)
self
.
assert
True
(
"Requires: another (==1.0)"
in
meta
)
self
.
assert
True
(
"obsoletes:"
not
in
meta
.
lower
())
def
test_requires_illegal
(
self
):
self
.
assertRaises
(
ValueError
,
Distribution
,
...
...
@@ -261,11 +261,11 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
self
.
assertEqual
(
dist
.
get_obsoletes
(),
[
"other"
,
"another (<1.0)"
])
meta
=
self
.
format_metadata
(
dist
)
self
.
assert
_
(
"Metadata-Version: 1.1"
in
meta
)
self
.
assert
_
(
"provides:"
not
in
meta
.
lower
())
self
.
assert
_
(
"requires:"
not
in
meta
.
lower
())
self
.
assert
_
(
"Obsoletes: other"
in
meta
)
self
.
assert
_
(
"Obsoletes: another (<1.0)"
in
meta
)
self
.
assert
True
(
"Metadata-Version: 1.1"
in
meta
)
self
.
assert
True
(
"provides:"
not
in
meta
.
lower
())
self
.
assert
True
(
"requires:"
not
in
meta
.
lower
())
self
.
assert
True
(
"Obsoletes: other"
in
meta
)
self
.
assert
True
(
"Obsoletes: another (<1.0)"
in
meta
)
def
test_obsoletes_illegal
(
self
):
self
.
assertRaises
(
ValueError
,
Distribution
,
...
...
@@ -299,14 +299,14 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
if
sys
.
platform
in
(
'linux'
,
'darwin'
):
self
.
environ
[
'HOME'
]
=
temp_dir
files
=
dist
.
find_config_files
()
self
.
assert
_
(
user_filename
in
files
)
self
.
assert
True
(
user_filename
in
files
)
# win32-style
if
sys
.
platform
==
'win32'
:
# home drive should be found
self
.
environ
[
'HOME'
]
=
temp_dir
files
=
dist
.
find_config_files
()
self
.
assert
_
(
user_filename
in
files
,
self
.
assert
True
(
user_filename
in
files
,
'%r not found in %r'
%
(
user_filename
,
files
))
finally
:
os
.
remove
(
user_filename
)
...
...
@@ -332,7 +332,7 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
output
=
[
line
for
line
in
s
.
getvalue
().
split
(
'
\
n
'
)
if
line
.
strip
()
!=
''
]
self
.
assert
_
(
len
(
output
)
>
0
)
self
.
assert
True
(
len
(
output
)
>
0
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
tests/test_install.py
View file @
0b41ce09
...
...
@@ -88,7 +88,7 @@ class InstallTestCase(support.TempdirManager,
def
_test_user_site
(
self
):
for
key
in
(
'nt_user'
,
'unix_user'
,
'os2_home'
):
self
.
assert
_
(
key
in
INSTALL_SCHEMES
)
self
.
assert
True
(
key
in
INSTALL_SCHEMES
)
dist
=
Distribution
({
'name'
:
'xx'
})
cmd
=
install
(
dist
)
...
...
@@ -96,24 +96,24 @@ class InstallTestCase(support.TempdirManager,
# making sure the user option is there
options
=
[
name
for
name
,
short
,
lable
in
cmd
.
user_options
]
self
.
assert
_
(
'user'
in
options
)
self
.
assert
True
(
'user'
in
options
)
# setting a value
cmd
.
user
=
1
# user base and site shouldn't be created yet
self
.
assert
_
(
not
os
.
path
.
exists
(
self
.
user_base
))
self
.
assert
_
(
not
os
.
path
.
exists
(
self
.
user_site
))
self
.
assert
True
(
not
os
.
path
.
exists
(
self
.
user_base
))
self
.
assert
True
(
not
os
.
path
.
exists
(
self
.
user_site
))
# let's run finalize
cmd
.
ensure_finalized
()
# now they should
self
.
assert
_
(
os
.
path
.
exists
(
self
.
user_base
))
self
.
assert
_
(
os
.
path
.
exists
(
self
.
user_site
))
self
.
assert
True
(
os
.
path
.
exists
(
self
.
user_base
))
self
.
assert
True
(
os
.
path
.
exists
(
self
.
user_site
))
self
.
assert
_
(
'userbase'
in
cmd
.
config_vars
)
self
.
assert
_
(
'usersite'
in
cmd
.
config_vars
)
self
.
assert
True
(
'userbase'
in
cmd
.
config_vars
)
self
.
assert
True
(
'usersite'
in
cmd
.
config_vars
)
def
test_handle_extra_path
(
self
):
dist
=
Distribution
({
'name'
:
'xx'
,
'extra_path'
:
'path,dirs'
})
...
...
tests/test_install_data.py
View file @
0b41ce09
...
...
@@ -35,9 +35,9 @@ class InstallDataTestCase(support.TempdirManager,
# let's check the result
self
.
assertEquals
(
len
(
cmd
.
get_outputs
()),
2
)
rtwo
=
os
.
path
.
split
(
two
)[
-
1
]
self
.
assert
_
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst2
,
rtwo
)))
self
.
assert
True
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst2
,
rtwo
)))
rone
=
os
.
path
.
split
(
one
)[
-
1
]
self
.
assert
_
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst
,
rone
)))
self
.
assert
True
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst
,
rone
)))
cmd
.
outfiles
=
[]
# let's try with warn_dir one
...
...
@@ -47,8 +47,8 @@ class InstallDataTestCase(support.TempdirManager,
# let's check the result
self
.
assertEquals
(
len
(
cmd
.
get_outputs
()),
2
)
self
.
assert
_
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst2
,
rtwo
)))
self
.
assert
_
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst
,
rone
)))
self
.
assert
True
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst2
,
rtwo
)))
self
.
assert
True
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst
,
rone
)))
cmd
.
outfiles
=
[]
# now using root and empty dir
...
...
@@ -65,8 +65,8 @@ class InstallDataTestCase(support.TempdirManager,
# let's check the result
self
.
assertEquals
(
len
(
cmd
.
get_outputs
()),
4
)
self
.
assert
_
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst2
,
rtwo
)))
self
.
assert
_
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst
,
rone
)))
self
.
assert
True
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst2
,
rtwo
)))
self
.
assert
True
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst
,
rone
)))
def
test_suite
():
return
unittest
.
makeSuite
(
InstallDataTestCase
)
...
...
tests/test_install_lib.py
View file @
0b41ce09
...
...
@@ -39,8 +39,8 @@ class InstallLibTestCase(support.TempdirManager,
f
=
os
.
path
.
join
(
pkg_dir
,
'foo.py'
)
self
.
write_file
(
f
,
'# python file'
)
cmd
.
byte_compile
([
f
])
self
.
assert
_
(
os
.
path
.
exists
(
os
.
path
.
join
(
pkg_dir
,
'foo.pyc'
)))
self
.
assert
_
(
os
.
path
.
exists
(
os
.
path
.
join
(
pkg_dir
,
'foo.pyo'
)))
self
.
assert
True
(
os
.
path
.
exists
(
os
.
path
.
join
(
pkg_dir
,
'foo.pyc'
)))
self
.
assert
True
(
os
.
path
.
exists
(
os
.
path
.
join
(
pkg_dir
,
'foo.pyo'
)))
def
test_get_outputs
(
self
):
pkg_dir
,
dist
=
self
.
create_dist
()
...
...
@@ -57,7 +57,7 @@ class InstallLibTestCase(support.TempdirManager,
cmd
.
distribution
.
script_name
=
'setup.py'
# get_output should return 4 elements
self
.
assert
_
(
len
(
cmd
.
get_outputs
())
>=
2
)
self
.
assert
True
(
len
(
cmd
.
get_outputs
())
>=
2
)
def
test_get_inputs
(
self
):
pkg_dir
,
dist
=
self
.
create_dist
()
...
...
tests/test_install_scripts.py
View file @
0b41ce09
...
...
@@ -23,15 +23,15 @@ class InstallScriptsTestCase(support.TempdirManager,
skip_build
=
1
,
)
cmd
=
install_scripts
(
dist
)
self
.
assert
_
(
not
cmd
.
force
)
self
.
assert
_
(
not
cmd
.
skip_build
)
self
.
assert
_
(
cmd
.
build_dir
is
None
)
self
.
assert
_
(
cmd
.
install_dir
is
None
)
self
.
assert
True
(
not
cmd
.
force
)
self
.
assert
True
(
not
cmd
.
skip_build
)
self
.
assert
True
(
cmd
.
build_dir
is
None
)
self
.
assert
True
(
cmd
.
install_dir
is
None
)
cmd
.
finalize_options
()
self
.
assert
_
(
cmd
.
force
)
self
.
assert
_
(
cmd
.
skip_build
)
self
.
assert
True
(
cmd
.
force
)
self
.
assert
True
(
cmd
.
skip_build
)
self
.
assertEqual
(
cmd
.
build_dir
,
"/foo/bar"
)
self
.
assertEqual
(
cmd
.
install_dir
,
"/splat/funk"
)
...
...
@@ -69,7 +69,7 @@ class InstallScriptsTestCase(support.TempdirManager,
installed
=
os
.
listdir
(
target
)
for
name
in
expected
:
self
.
assert
_
(
name
in
installed
)
self
.
assert
True
(
name
in
installed
)
def
test_suite
():
...
...
tests/test_msvc9compiler.py
View file @
0b41ce09
...
...
@@ -46,7 +46,7 @@ class msvc9compilerTestCase(unittest.TestCase):
# windows registeries versions.
path
=
r'Software\
Mic
rosoft\
No
tepad'
v
=
Reg
.
get_value
(
path
,
u"lfitalic"
)
self
.
assert
_
(
v
in
(
0
,
1
))
self
.
assert
True
(
v
in
(
0
,
1
))
import
_winreg
HKCU
=
_winreg
.
HKEY_CURRENT_USER
...
...
@@ -54,7 +54,7 @@ class msvc9compilerTestCase(unittest.TestCase):
self
.
assertEquals
(
keys
,
None
)
keys
=
Reg
.
read_keys
(
HKCU
,
r'Software\
Mic
rosoft'
)
self
.
assert
_
(
'Notepad'
in
keys
)
self
.
assert
True
(
'Notepad'
in
keys
)
def
test_suite
():
return
unittest
.
makeSuite
(
msvc9compilerTestCase
)
...
...
tests/test_register.py
View file @
0b41ce09
...
...
@@ -96,7 +96,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
cmd
=
self
.
_get_cmd
()
# we shouldn't have a .pypirc file yet
self
.
assert
_
(
not
os
.
path
.
exists
(
self
.
rc
))
self
.
assert
True
(
not
os
.
path
.
exists
(
self
.
rc
))
# patching raw_input and getpass.getpass
# so register gets happy
...
...
@@ -115,7 +115,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
del
register_module
.
raw_input
# we should have a brand new .pypirc file
self
.
assert
_
(
os
.
path
.
exists
(
self
.
rc
))
self
.
assert
True
(
os
.
path
.
exists
(
self
.
rc
))
# with the content similar to WANTED_PYPIRC
content
=
open
(
self
.
rc
).
read
()
...
...
@@ -133,13 +133,13 @@ class RegisterTestCase(PyPIRCCommandTestCase):
# let's see what the server received : we should
# have 2 similar requests
self
.
assert
_
(
self
.
conn
.
reqs
,
2
)
self
.
assert
True
(
self
.
conn
.
reqs
,
2
)
req1
=
dict
(
self
.
conn
.
reqs
[
0
].
headers
)
req2
=
dict
(
self
.
conn
.
reqs
[
1
].
headers
)
self
.
assertEquals
(
req1
[
'Content-length'
],
'1374'
)
self
.
assertEquals
(
req2
[
'Content-length'
],
'1374'
)
self
.
assert
_
(
'xxx'
in
self
.
conn
.
reqs
[
1
].
data
)
self
.
assert
True
(
'xxx'
in
self
.
conn
.
reqs
[
1
].
data
)
def
test_password_not_in_file
(
self
):
...
...
@@ -165,11 +165,11 @@ class RegisterTestCase(PyPIRCCommandTestCase):
del
register_module
.
raw_input
# we should have send a request
self
.
assert
_
(
self
.
conn
.
reqs
,
1
)
self
.
assert
True
(
self
.
conn
.
reqs
,
1
)
req
=
self
.
conn
.
reqs
[
0
]
headers
=
dict
(
req
.
headers
)
self
.
assertEquals
(
headers
[
'Content-length'
],
'608'
)
self
.
assert
_
(
'tarek'
in
req
.
data
)
self
.
assert
True
(
'tarek'
in
req
.
data
)
def
test_password_reset
(
self
):
# this test runs choice 3
...
...
@@ -183,11 +183,11 @@ class RegisterTestCase(PyPIRCCommandTestCase):
del
register_module
.
raw_input
# we should have send a request
self
.
assert
_
(
self
.
conn
.
reqs
,
1
)
self
.
assert
True
(
self
.
conn
.
reqs
,
1
)
req
=
self
.
conn
.
reqs
[
0
]
headers
=
dict
(
req
.
headers
)
self
.
assertEquals
(
headers
[
'Content-length'
],
'290'
)
self
.
assert
_
(
'tarek'
in
req
.
data
)
self
.
assert
True
(
'tarek'
in
req
.
data
)
def
test_strict
(
self
):
# testing the script option
...
...
tests/test_sysconfig.py
View file @
0b41ce09
...
...
@@ -21,12 +21,12 @@ class SysconfigTestCase(support.EnvironGuard,
def
test_get_config_h_filename
(
self
):
config_h
=
sysconfig
.
get_config_h_filename
()
self
.
assert
_
(
os
.
path
.
isfile
(
config_h
),
config_h
)
self
.
assert
True
(
os
.
path
.
isfile
(
config_h
),
config_h
)
def
test_get_python_lib
(
self
):
lib_dir
=
sysconfig
.
get_python_lib
()
# XXX doesn't work on Linux when Python was never installed before
#self.assert
_
(os.path.isdir(lib_dir), lib_dir)
#self.assert
True
(os.path.isdir(lib_dir), lib_dir)
# test for pythonxx.lib?
self
.
assertNotEqual
(
sysconfig
.
get_python_lib
(),
sysconfig
.
get_python_lib
(
prefix
=
TESTFN
))
...
...
@@ -36,14 +36,14 @@ class SysconfigTestCase(support.EnvironGuard,
# This is not much of a test. We make sure Python.h exists
# in the directory returned by get_python_inc() but we don't know
# it is the correct file.
self
.
assert
_
(
os
.
path
.
isdir
(
inc_dir
),
inc_dir
)
self
.
assert
True
(
os
.
path
.
isdir
(
inc_dir
),
inc_dir
)
python_h
=
os
.
path
.
join
(
inc_dir
,
"Python.h"
)
self
.
assert
_
(
os
.
path
.
isfile
(
python_h
),
python_h
)
self
.
assert
True
(
os
.
path
.
isfile
(
python_h
),
python_h
)
def
test_get_config_vars
(
self
):
cvars
=
sysconfig
.
get_config_vars
()
self
.
assert
_
(
isinstance
(
cvars
,
dict
))
self
.
assert
_
(
cvars
)
self
.
assert
True
(
isinstance
(
cvars
,
dict
))
self
.
assert
True
(
cvars
)
def
test_customize_compiler
(
self
):
...
...
tests/test_upload.py
View file @
0b41ce09
...
...
@@ -96,11 +96,11 @@ class uploadTestCase(PyPIRCCommandTestCase):
# what did we send ?
headers
=
dict
(
self
.
last_open
.
req
.
headers
)
self
.
assertEquals
(
headers
[
'Content-length'
],
'2086'
)
self
.
assert
_
(
headers
[
'Content-type'
].
startswith
(
'multipart/form-data'
))
self
.
assert
True
(
headers
[
'Content-type'
].
startswith
(
'multipart/form-data'
))
self
.
assertEquals
(
self
.
last_open
.
req
.
get_method
(),
'POST'
)
self
.
assertEquals
(
self
.
last_open
.
req
.
get_full_url
(),
'http://pypi.python.org/pypi'
)
self
.
assert
_
(
'xxx'
in
self
.
last_open
.
req
.
data
)
self
.
assert
True
(
'xxx'
in
self
.
last_open
.
req
.
data
)
def
test_suite
():
return
unittest
.
makeSuite
(
uploadTestCase
)
...
...
tests/test_util.py
View file @
0b41ce09
...
...
@@ -225,10 +225,10 @@ class UtilTestCase(support.EnvironGuard, unittest.TestCase):
no
=
(
'n'
,
'no'
,
'f'
,
'false'
,
'off'
,
'0'
,
'Off'
,
'No'
,
'N'
)
for
y
in
yes
:
self
.
assert
_
(
strtobool
(
y
))
self
.
assert
True
(
strtobool
(
y
))
for
n
in
no
:
self
.
assert
_
(
not
strtobool
(
n
))
self
.
assert
True
(
not
strtobool
(
n
))
def
test_rfc822_escape
(
self
):
header
=
'I am a
\
n
poor
\
n
lonesome
\
n
header
\
n
'
...
...
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