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
64a2f9e8
Kaydet (Commit)
64a2f9e8
authored
Şub 05, 2017
tarafından
Steve Dower
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge from 3.6
üst
49226e23
0c8ee60e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
test_winconsoleio.py
Lib/test/test_winconsoleio.py
+27
-15
No files found.
Lib/test/test_winconsoleio.py
Dosyayı görüntüle @
64a2f9e8
'''Tests for WindowsConsoleIO
'''
import
os
import
io
import
os
import
sys
import
unittest
import
tempfile
import
unittest
if
sys
.
platform
!=
'win32'
:
raise
unittest
.
SkipTest
(
"test only relevant on win32"
)
...
...
@@ -26,8 +26,10 @@ class WindowsConsoleIOTests(unittest.TestCase):
fd
,
_
=
tempfile
.
mkstemp
()
try
:
# Windows 10: "Cannot open non-console file"
# Earlier: "Cannot open console output buffer for reading"
self
.
assertRaisesRegex
(
ValueError
,
"Cannot open
non-console file
"
,
ConIO
,
fd
)
"Cannot open
(console|non-console file)
"
,
ConIO
,
fd
)
finally
:
os
.
close
(
fd
)
...
...
@@ -70,18 +72,6 @@ class WindowsConsoleIOTests(unittest.TestCase):
def
test_open_name
(
self
):
self
.
assertRaises
(
ValueError
,
ConIO
,
sys
.
executable
)
f
=
open
(
'C:/con'
,
'rb'
,
buffering
=
0
)
self
.
assertIsInstance
(
f
,
ConIO
)
f
.
close
()
f
=
open
(
r'\\.\conin$'
,
'rb'
,
buffering
=
0
)
self
.
assertIsInstance
(
f
,
ConIO
)
f
.
close
()
f
=
open
(
'//?/conout$'
,
'wb'
,
buffering
=
0
)
self
.
assertIsInstance
(
f
,
ConIO
)
f
.
close
()
f
=
ConIO
(
"CON"
)
self
.
assertTrue
(
f
.
readable
())
self
.
assertFalse
(
f
.
writable
())
...
...
@@ -103,6 +93,28 @@ class WindowsConsoleIOTests(unittest.TestCase):
f
.
close
()
f
.
close
()
f
=
open
(
'C:/con'
,
'rb'
,
buffering
=
0
)
self
.
assertIsInstance
(
f
,
ConIO
)
f
.
close
()
try
:
f
=
open
(
r'\\.\conin$'
,
'rb'
,
buffering
=
0
)
except
FileNotFoundError
:
# If we cannot find the file, this part should be skipped
print
(
'
\\\\
.
\\
conin$ was not found on this OS'
)
else
:
self
.
assertIsInstance
(
f
,
ConIO
)
f
.
close
()
try
:
f
=
open
(
'//?/conout$'
,
'wb'
,
buffering
=
0
)
except
FileNotFoundError
:
# If we cannot find the file, this part should be skipped
print
(
'//?/conout$ was not found on this OS'
)
else
:
self
.
assertIsInstance
(
f
,
ConIO
)
f
.
close
()
def
assertStdinRoundTrip
(
self
,
text
):
stdin
=
open
(
'CONIN$'
,
'r'
)
old_stdin
=
sys
.
stdin
...
...
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