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
d141531e
Kaydet (Commit)
d141531e
authored
Tem 22, 2016
tarafından
Xavier de Gaye
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27472: Add test.support.unix_shell as the path to the default shell.
üst
de85ed69
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
13 deletions
+24
-13
test_spawn.py
Lib/distutils/tests/test_spawn.py
+6
-5
__init__.py
Lib/test/support/__init__.py
+6
-1
test_os.py
Lib/test/test_os.py
+8
-5
test_subprocess.py
Lib/test/test_subprocess.py
+2
-2
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/distutils/tests/test_spawn.py
Dosyayı görüntüle @
d141531e
"""Tests for distutils.spawn."""
import
unittest
import
sys
import
os
from
test.support
import
run_unittest
from
test.support
import
run_unittest
,
unix_shell
from
distutils.spawn
import
_nt_quote_args
from
distutils.spawn
import
spawn
...
...
@@ -29,9 +30,9 @@ class SpawnTestCase(support.TempdirManager,
# creating something executable
# through the shell that returns 1
if
os
.
name
==
'posix
'
:
if
sys
.
platform
!=
'win32
'
:
exe
=
os
.
path
.
join
(
tmpdir
,
'foo.sh'
)
self
.
write_file
(
exe
,
'#!
/bin/sh
\n
exit 1'
)
self
.
write_file
(
exe
,
'#!
%
s
\n
exit 1'
%
unix_shell
)
else
:
exe
=
os
.
path
.
join
(
tmpdir
,
'foo.bat'
)
self
.
write_file
(
exe
,
'exit 1'
)
...
...
@@ -40,9 +41,9 @@ class SpawnTestCase(support.TempdirManager,
self
.
assertRaises
(
DistutilsExecError
,
spawn
,
[
exe
])
# now something that works
if
os
.
name
==
'posix
'
:
if
sys
.
platform
!=
'win32
'
:
exe
=
os
.
path
.
join
(
tmpdir
,
'foo.sh'
)
self
.
write_file
(
exe
,
'#!
/bin/sh
\n
exit 0'
)
self
.
write_file
(
exe
,
'#!
%
s
\n
exit 0'
%
unix_shell
)
else
:
exe
=
os
.
path
.
join
(
tmpdir
,
'foo.bat'
)
self
.
write_file
(
exe
,
'exit 0'
)
...
...
Lib/test/support/__init__.py
Dosyayı görüntüle @
d141531e
...
...
@@ -92,7 +92,7 @@ __all__ = [
"anticipate_failure"
,
"load_package_tests"
,
"detect_api_mismatch"
,
"check__all__"
,
# sys
"is_jython"
,
"is_android"
,
"check_impl_detail"
,
"is_jython"
,
"is_android"
,
"check_impl_detail"
,
"unix_shell"
,
# network
"HOST"
,
"IPV6_ENABLED"
,
"find_unused_port"
,
"bind_port"
,
"open_urlresource"
,
# processes
...
...
@@ -736,6 +736,11 @@ is_jython = sys.platform.startswith('java')
is_android
=
bool
(
sysconfig
.
get_config_var
(
'ANDROID_API_LEVEL'
))
if
sys
.
platform
!=
'win32'
:
unix_shell
=
'/system/bin/sh'
if
is_android
else
'/bin/sh'
else
:
unix_shell
=
None
# Filename used for testing
if
os
.
name
==
'java'
:
# Jython disallows @ in module names
...
...
Lib/test/test_os.py
Dosyayı görüntüle @
d141531e
...
...
@@ -64,6 +64,7 @@ except ImportError:
INT_MAX
=
PY_SSIZE_T_MAX
=
sys
.
maxsize
from
test.support.script_helper
import
assert_python_ok
from
test.support
import
unix_shell
root_in_posix
=
False
...
...
@@ -670,18 +671,20 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
return
os
.
environ
# Bug 1110478
@unittest.skipUnless
(
os
.
path
.
exists
(
'/bin/sh'
),
'requires /bin/sh'
)
@unittest.skipUnless
(
unix_shell
and
os
.
path
.
exists
(
unix_shell
),
'requires a shell'
)
def
test_update2
(
self
):
os
.
environ
.
clear
()
os
.
environ
.
update
(
HELLO
=
"World"
)
with
os
.
popen
(
"
/bin/sh -c 'echo $HELLO'"
)
as
popen
:
with
os
.
popen
(
"
%
s -c 'echo $HELLO'"
%
unix_shell
)
as
popen
:
value
=
popen
.
read
()
.
strip
()
self
.
assertEqual
(
value
,
"World"
)
@unittest.skipUnless
(
os
.
path
.
exists
(
'/bin/sh'
),
'requires /bin/sh'
)
@unittest.skipUnless
(
unix_shell
and
os
.
path
.
exists
(
unix_shell
),
'requires a shell'
)
def
test_os_popen_iter
(
self
):
with
os
.
popen
(
"/bin/sh -c 'echo
\"
line1
\n
line2
\n
line3
\"
'"
)
as
popen
:
with
os
.
popen
(
"
%
s -c 'echo
\"
line1
\n
line2
\n
line3
\"
'"
%
unix_shell
)
as
popen
:
it
=
iter
(
popen
)
self
.
assertEqual
(
next
(
it
),
"line1
\n
"
)
self
.
assertEqual
(
next
(
it
),
"line2
\n
"
)
...
...
Lib/test/test_subprocess.py
Dosyayı görüntüle @
d141531e
...
...
@@ -1579,7 +1579,7 @@ class POSIXProcessTestCase(BaseTestCase):
fd
,
fname
=
tempfile
.
mkstemp
()
# reopen in text mode
with
open
(
fd
,
"w"
,
errors
=
"surrogateescape"
)
as
fobj
:
fobj
.
write
(
"#!
/bin/sh
\n
"
)
fobj
.
write
(
"#!
%
s
\n
"
%
support
.
unix_shell
)
fobj
.
write
(
"exec '
%
s' -c 'import sys; sys.exit(47)'
\n
"
%
sys
.
executable
)
os
.
chmod
(
fname
,
0
o700
)
...
...
@@ -1624,7 +1624,7 @@ class POSIXProcessTestCase(BaseTestCase):
fd
,
fname
=
tempfile
.
mkstemp
()
# reopen in text mode
with
open
(
fd
,
"w"
,
errors
=
"surrogateescape"
)
as
fobj
:
fobj
.
write
(
"#!
/bin/sh
\n
"
)
fobj
.
write
(
"#!
%
s
\n
"
%
support
.
unix_shell
)
fobj
.
write
(
"exec '
%
s' -c 'import sys; sys.exit(47)'
\n
"
%
sys
.
executable
)
os
.
chmod
(
fname
,
0
o700
)
...
...
Misc/NEWS
Dosyayı görüntüle @
d141531e
...
...
@@ -46,6 +46,8 @@ Library
Tests
-----
- Issue #27472: Add test.support.unix_shell as the path to the default shell.
- Issue #27369: In test_pyexpat, avoid testing an error message detail that
changed in Expat 2.2.0.
...
...
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