Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
65defaa3
Commit
65defaa3
authored
Oct 16, 2017
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: initial first_stage_test.
parent
3d0e8c36
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
tests/first_stage_test.py
tests/first_stage_test.py
+42
-0
tests/testlib.py
tests/testlib.py
+3
-0
No files found.
tests/first_stage_test.py
0 → 100644
View file @
65defaa3
import
subprocess
import
unittest
import
mitogen.master
import
testlib
class
CommandLineTest
(
testlib
.
RouterMixin
,
testlib
.
TestCase
):
# Ensure this version of Python produces a command line that is sufficient
# to bootstrap this version of Python.
#
# TODO:
# * 2.7 starting 2.4
# * 2.7 starting 3.x
# * 3.x starting 2.7
def
test_valid_syntax
(
self
):
stream
=
mitogen
.
master
.
Stream
(
self
.
router
,
0
)
args
=
stream
.
get_boot_command
()
# Executing the boot command will print "EC0" and expect to read from
# stdin, which will fail because it's pointing at /dev/null, causing
# the forked child to crash with an EOFError and disconnect its write
# pipe. The forked and freshly execed parent will get a 0-byte read
# from the pipe, which is a valid script, and therefore exit indicating
# success.
fp
=
file
(
"/dev/null"
,
"r"
)
proc
=
subprocess
.
Popen
(
args
,
stdin
=
fp
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
)
stdout
,
stderr
=
proc
.
communicate
()
self
.
assertEquals
(
0
,
proc
.
returncode
)
self
.
assertEquals
(
"EC0
\
n
"
,
stdout
)
self
.
assertContains
(
"EOFError"
,
stderr
)
if
__name__
==
'__main__'
:
unittest
.
main
()
tests/testlib.py
View file @
65defaa3
...
...
@@ -111,6 +111,9 @@ class TestCase(unittest.TestCase):
assert
0
,
'%r raised %r, not %r'
%
(
func
,
e
,
exc
)
assert
0
,
'%r did not raise %r'
%
(
func
,
exc
)
def
assertContains
(
self
,
needle
,
hay
):
assert
needle
in
hay
,
"%r not found in %r"
%
(
needle
,
hay
)
class
DockerizedSshDaemon
(
object
):
def
__init__
(
self
):
...
...
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