Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
11b34d07
Kaydet (Commit)
11b34d07
authored
Şub 23, 2009
tarafından
Tarek Ziadé
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
more test coverage
üst
89d4f0d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
0 deletions
+150
-0
test_bdist_dumb.py
Lib/distutils/tests/test_bdist_dumb.py
+80
-0
test_version.py
Lib/distutils/tests/test_version.py
+70
-0
No files found.
Lib/distutils/tests/test_bdist_dumb.py
0 → 100644
Dosyayı görüntüle @
11b34d07
"""Tests for distutils.command.bdist_dumb."""
import
unittest
import
sys
import
os
from
distutils.core
import
Distribution
from
distutils.command.bdist_dumb
import
bdist_dumb
from
distutils.tests
import
support
SETUP_PY
=
"""
\
from distutils.core import setup
import foo
setup(name='foo', version='0.1', py_modules=['foo'],
url='xxx', author='xxx', author_email='xxx')
"""
class
BuildDumbTestCase
(
support
.
TempdirManager
,
support
.
LoggingSilencer
,
unittest
.
TestCase
):
def
setUp
(
self
):
support
.
TempdirManager
.
setUp
(
self
)
support
.
LoggingSilencer
.
setUp
(
self
)
self
.
old_location
=
os
.
getcwd
()
self
.
old_sys_argv
=
sys
.
argv
[:]
def
tearDown
(
self
):
os
.
chdir
(
self
.
old_location
)
sys
.
argv
=
self
.
old_sys_argv
[:]
support
.
LoggingSilencer
.
tearDown
(
self
)
support
.
TempdirManager
.
tearDown
(
self
)
def
test_simple_built
(
self
):
# let's create a simple package
tmp_dir
=
self
.
mkdtemp
()
pkg_dir
=
os
.
path
.
join
(
tmp_dir
,
'foo'
)
os
.
mkdir
(
pkg_dir
)
self
.
write_file
((
pkg_dir
,
'setup.py'
),
SETUP_PY
)
self
.
write_file
((
pkg_dir
,
'foo.py'
),
'#'
)
self
.
write_file
((
pkg_dir
,
'MANIFEST.in'
),
'include foo.py'
)
self
.
write_file
((
pkg_dir
,
'README'
),
''
)
dist
=
Distribution
({
'name'
:
'foo'
,
'version'
:
'0.1'
,
'py_modules'
:
[
'foo'
],
'url'
:
'xxx'
,
'author'
:
'xxx'
,
'author_email'
:
'xxx'
})
dist
.
script_name
=
'setup.py'
os
.
chdir
(
pkg_dir
)
sys
.
argv
=
[
'setup.py'
]
cmd
=
bdist_dumb
(
dist
)
# so the output is the same no matter
# what is the platform
cmd
.
format
=
'zip'
cmd
.
ensure_finalized
()
cmd
.
run
()
# see what we have
dist_created
=
os
.
listdir
(
os
.
path
.
join
(
pkg_dir
,
'dist'
))
base
=
"
%
s.
%
s"
%
(
dist
.
get_fullname
(),
cmd
.
plat_name
)
if
os
.
name
==
'os2'
:
base
=
base
.
replace
(
':'
,
'-'
)
wanted
=
[
'
%
s.zip'
%
base
]
self
.
assertEquals
(
dist_created
,
wanted
)
# now let's check what we have in the zip file
# XXX to be done
def
test_suite
():
return
unittest
.
makeSuite
(
BuildDumbTestCase
)
if
__name__
==
'__main__'
:
test_support
.
run_unittest
(
test_suite
())
Lib/distutils/tests/test_version.py
0 → 100644
Dosyayı görüntüle @
11b34d07
"""Tests for distutils.version."""
import
unittest
from
distutils.version
import
LooseVersion
from
distutils.version
import
StrictVersion
class
VersionTestCase
(
unittest
.
TestCase
):
def
test_prerelease
(
self
):
version
=
StrictVersion
(
'1.2.3a1'
)
self
.
assertEquals
(
version
.
version
,
(
1
,
2
,
3
))
self
.
assertEquals
(
version
.
prerelease
,
(
'a'
,
1
))
self
.
assertEquals
(
str
(
version
),
'1.2.3a1'
)
version
=
StrictVersion
(
'1.2.0'
)
self
.
assertEquals
(
str
(
version
),
'1.2'
)
def
test_cmp_strict
(
self
):
versions
=
((
'1.5.1'
,
'1.5.2b2'
,
-
1
),
(
'161'
,
'3.10a'
,
ValueError
),
(
'8.02'
,
'8.02'
,
0
),
(
'3.4j'
,
'1996.07.12'
,
ValueError
),
(
'3.2.pl0'
,
'3.1.1.6'
,
ValueError
),
(
'2g6'
,
'11g'
,
ValueError
),
(
'0.9'
,
'2.2'
,
-
1
),
(
'1.2.1'
,
'1.2'
,
1
),
(
'1.1'
,
'1.2.2'
,
-
1
),
(
'1.2'
,
'1.1'
,
1
),
(
'1.2.1'
,
'1.2.2'
,
-
1
),
(
'1.2.2'
,
'1.2'
,
1
),
(
'1.2'
,
'1.2.2'
,
-
1
),
(
'0.4.0'
,
'0.4'
,
0
),
(
'1.13++'
,
'5.5.kw'
,
ValueError
))
for
v1
,
v2
,
wanted
in
versions
:
try
:
res
=
StrictVersion
(
v1
)
.
__cmp__
(
StrictVersion
(
v2
))
except
ValueError
:
if
wanted
is
ValueError
:
continue
else
:
raise
AssertionError
((
"cmp(
%
s,
%
s) "
"shouldn't raise ValueError"
)
%
(
v1
,
v2
))
self
.
assertEquals
(
res
,
wanted
,
'cmp(
%
s,
%
s) should be
%
s, got
%
s'
%
(
v1
,
v2
,
wanted
,
res
))
def
test_cmp
(
self
):
versions
=
((
'1.5.1'
,
'1.5.2b2'
,
-
1
),
(
'161'
,
'3.10a'
,
1
),
(
'8.02'
,
'8.02'
,
0
),
(
'3.4j'
,
'1996.07.12'
,
-
1
),
(
'3.2.pl0'
,
'3.1.1.6'
,
1
),
(
'2g6'
,
'11g'
,
-
1
),
(
'0.960923'
,
'2.2beta29'
,
-
1
),
(
'1.13++'
,
'5.5.kw'
,
-
1
))
for
v1
,
v2
,
wanted
in
versions
:
res
=
LooseVersion
(
v1
)
.
__cmp__
(
LooseVersion
(
v2
))
self
.
assertEquals
(
res
,
wanted
,
'cmp(
%
s,
%
s) should be
%
s, got
%
s'
%
(
v1
,
v2
,
wanted
,
res
))
def
test_suite
():
return
unittest
.
makeSuite
(
VersionTestCase
)
if
__name__
==
"__main__"
:
unittest
.
main
(
defaultTest
=
"test_suite"
)
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