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
b8ab8b6d
Kaydet (Commit)
b8ab8b6d
authored
Haz 17, 2004
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
move support code to a helper module to ease re-use
üst
9e1ac249
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
34 deletions
+48
-34
support.py
Lib/distutils/tests/support.py
+41
-0
test_install_scripts.py
Lib/distutils/tests/test_install_scripts.py
+7
-34
No files found.
Lib/distutils/tests/support.py
0 → 100644
Dosyayı görüntüle @
b8ab8b6d
"""Support code for distutils test cases."""
import
shutil
import
tempfile
class
TempdirManager
(
object
):
"""Mix-in class that handles temporary directories for test cases.
This is intended to be used with unittest.TestCase.
"""
def
setUp
(
self
):
super
(
TempdirManager
,
self
)
.
setUp
()
self
.
tempdirs
=
[]
def
tearDown
(
self
):
super
(
TempdirManager
,
self
)
.
tearDown
()
while
self
.
tempdirs
:
d
=
self
.
tempdirs
.
pop
()
shutil
.
rmtree
(
d
)
def
mkdtemp
(
self
):
"""Create a temporary directory that will be cleaned up.
Returns the path of the directory.
"""
d
=
tempfile
.
mkdtemp
()
self
.
tempdirs
.
append
(
d
)
return
d
class
DummyCommand
:
"""Class to store options for retrieval via set_undefined_options()."""
def
__init__
(
self
,
**
kwargs
):
for
kw
,
val
in
kwargs
.
items
():
setattr
(
self
,
kw
,
val
)
def
ensure_finalized
(
self
):
pass
Lib/distutils/tests/test_install_scripts.py
Dosyayı görüntüle @
b8ab8b6d
"""Tests for distutils.command.install_scripts."""
import
os
import
shutil
import
tempfile
import
unittest
from
distutils.command.install_scripts
import
install_scripts
from
distutils.core
import
Distribution
from
distutils.tests
import
support
class
InstallScriptsTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
tempdirs
=
[]
def
tearDown
(
self
):
while
self
.
tempdirs
:
d
=
self
.
tempdirs
.
pop
()
shutil
.
rmtree
(
d
)
def
mkdtemp
(
self
):
"""Create a temporary directory that will be cleaned up.
Returns the path of the directory.
"""
d
=
tempfile
.
mkdtemp
()
self
.
tempdirs
.
append
(
d
)
return
d
class
InstallScriptsTestCase
(
support
.
TempdirManager
,
unittest
.
TestCase
):
def
test_default_settings
(
self
):
dist
=
Distribution
()
dist
.
command_obj
[
"build"
]
=
DummyCommand
(
build_scripts
=
"/foo/bar"
)
dist
.
command_obj
[
"install"
]
=
DummyCommand
(
dist
.
command_obj
[
"build"
]
=
support
.
DummyCommand
(
build_scripts
=
"/foo/bar"
)
dist
.
command_obj
[
"install"
]
=
support
.
DummyCommand
(
install_scripts
=
"/splat/funk"
,
force
=
1
,
skip_build
=
1
,
...
...
@@ -71,8 +55,8 @@ class InstallScriptsTestCase(unittest.TestCase):
target
=
self
.
mkdtemp
()
dist
=
Distribution
()
dist
.
command_obj
[
"build"
]
=
DummyCommand
(
build_scripts
=
source
)
dist
.
command_obj
[
"install"
]
=
DummyCommand
(
dist
.
command_obj
[
"build"
]
=
support
.
DummyCommand
(
build_scripts
=
source
)
dist
.
command_obj
[
"install"
]
=
support
.
DummyCommand
(
install_scripts
=
target
,
force
=
1
,
skip_build
=
1
,
...
...
@@ -86,17 +70,6 @@ class InstallScriptsTestCase(unittest.TestCase):
self
.
assert_
(
name
in
installed
)
class
DummyCommand
:
"""Class to store options for retrieval via set_undefined_options()."""
def
__init__
(
self
,
**
kwargs
):
for
kw
,
val
in
kwargs
.
items
():
setattr
(
self
,
kw
,
val
)
def
ensure_finalized
(
self
):
pass
def
test_suite
():
return
unittest
.
makeSuite
(
InstallScriptsTestCase
)
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