To integrate with unittest, it would be nice to do:
$ touch scripts/tests/__init__.py
$ bzr add scripts/tests/__init__.py
After that, i'd expect:
$ cd scripts/
$ python3 -m unittest
to run all tests (skip as appropriate), instead this happens:
.....FF
======================================================================
FAIL: test_chroot_session_reexec
(tests.test_pyupstart_system_init.TestSystemInitChrootSession)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/xnox/canonical/upstart/upstart/scripts/tests/test_pyupstart_system_init.py",
line 46, in setUp
self.assertEqual(os.geteuid(), 0)
AssertionError: 1000 != 0
======================================================================
FAIL: test_pid1_reexec (tests.test_pyupstart_system_init.TestSystemInitReExec)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/xnox/canonical/upstart/upstart/scripts/tests/test_pyupstart_system_init.py",
line 46, in setUp
self.assertEqual(os.geteuid(), 0)
AssertionError: 1000 != 0
----------------------------------------------------------------------
Ran 7 tests in 5.281s
FAILED (failures=2)
Furthermore, it seems like there is information missing on how to run the
system test:
xnox@sochi:~/canonical/upstart/upstart/scripts$ sudo python3 -m unittest -v
tests.test_pyupstart_system_init
test_chroot_session_reexec
(tests.test_pyupstart_system_init.TestSystemInitChrootSession) ... skipped
'UPSTART_TEST_CHROOT_PATH variable not set'
test_pid1_reexec (tests.test_pyupstart_system_init.TestSystemInitReExec) ...
ERROR:dbus.proxies:Introspect error on None:/com/ubuntu/Upstart:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not
receive a reply. Possible causes include: the remote application did not send a
reply, the message bus security policy blocked the reply, the reply timeout
expired, or the network connection was broken.
ERROR
======================================================================
ERROR: test_pid1_reexec (tests.test_pyupstart_system_init.TestSystemInitReExec)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./tests/test_pyupstart_system_init.py", line 103, in test_pid1_reexec
job.start()
File "./pyupstart.py", line 553, in start
instance_path = self.interface.Start(dbus.Array(env, 's'), wait)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in
call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Disconnected:
Connection is closed
----------------------------------------------------------------------
Ran 2 tests in 1.037s
FAILED (errors=1, skipped=1)
So I think, when not root, the system tests should use skip them-self.
I'm still trying to create propoer environment to run the chroot test. Need to
reboot.
--
https://code.launchpad.net/~jamesodhunt/upstart/python-upstart-module/+merge/157549
Your team Upstart Reviewers is subscribed to branch lp:upstart.
--
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/upstart-devel