Commit Graph

438 Commits (7aca02c2c759e38d4c2c1b7538f7ef45247a03db)
 

Author SHA1 Message Date
David Wilson bbcfc585a8 master: add a comment to explain what's going on, and fix log msg.
Closes #70
7 years ago
David Wilson 3cbe9baf6d issue #70: remove redundant 'raise SystemExit'
Either execvp succeeds, in which case the process image is replaced, or
execvp throws an exception, in which case control flow exits the frame
anyway.
7 years ago
David Wilson b2909ee5f4 Replace nasty print statements in six_brokenpkg. 7 years ago
David Wilson 4f934465b3 Remove overall build timeout from .travis.yml. 7 years ago
David Wilson da8253bab5 Fix broken requires file syntax. 7 years ago
David Wilson 326886832e Add license text everywhere. 7 years ago
David Wilson f1f36cec35 Simplify the API, make Broker optional and auto-shutdown on main thread exit. 7 years ago
David Wilson f077b5b092 issue #56: fix up setup.py, bump version number. 7 years ago
Alex Willmer 7e01c5bed5 Import and use unittest2 without aliasing it 7 years ago
Alex Willmer e8e023ce59 Use specific TestCase assertions throughout tests
e.g. assert x == y -> self.assertEqual(x, y);
self.assertTrue(isinstance(x, y)) -> self.assertIsInstance(x, y)

These specific methods give more useful errors in the case of a test
failure.
7 years ago
Alex Willmer df9556d1d9 Replace custom assertContains() with unitest2 assertIn() 7 years ago
Alex Willmer 17da6e9998 Use unittest2 in all tests
This allows using features such as TestCase,assertIsInstance on Python
2.6 and earlier.
7 years ago
Alex Willmer d743823a5e Require unittest2 7 years ago
David Wilson bbcf1a0bd4 Fix confusing return statements, closes #67. 7 years ago
Alex Willmer 3831ac360f Replace all calls to file() with open()
Although these are synonyms in Python 2.x, when using MyPy to typecheck
code use of file() causes spurious errors.

This commit also serves as one small step to Python 3.x compatibility,
since 3.x removes the file() builtin.
7 years ago
Taihsiang Ho (tai271828) 4e4c9894cf Describe the installation and test process
We use test.sh to consolidate test cases in one file so the README
would not be outdated easier rather than the hard-coded test commands
in a code block.
7 years ago
R W H Bricheno df61f6ab4d Prevent MacOS exception on shutdown of closed socket. 7 years ago
R W H Bricheno 39f325af3e Fix getting the directory path on Mac OS X. 7 years ago
David Wilson c09dcd82a7 Fix Python 3 fix :/ closes #57 7 years ago
Alex Willmer 026669aa93 tests: Fix GetModuleViaPkgutilTest fetching .pyc
On my laptop (Ubuntu 17.10, Python 2.7.14 in a virtualenv),
`test_regular_mod` fails with

```
AssertionError: "\nimport sys\n\n\ndef say_hi():\n    print 'hi'\n" !=
'\x03\xf3\r\n\xbbW\xd5Yc\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00@\x00\x00\x00s\x19\x00\x00\x00d\x00\x00d\x01\x00l\x00\x00Z\x00\x00d\x02\x00\x84\x00\x00Z\x01\x00d\x01\x00S(\x03\x00\x00\x00i\xff\xff\xff\xffNc\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00C\x00\x00\x00s\t\x00\x00\x00d\x01\x00GHd\x00\x00S(\x02\x00\x00\x00Nt\x02\x00\x00\x00hi(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00sF\x00\x00\x00/home/alex/src/mitogen/tests/data/module_finder_testmod/regular_mod.pyt\x06\x00\x00\x00say_hi\x05\x00\x00\x00s\x02\x00\x00\x00\x00\x01(\x02\x00\x00\x00t\x03\x00\x00\x00sysR\x01\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00sF\x00\x00\x00/home/alex/src/mitogen/tests/data/module_finder_testmod/regular_mod.pyt\x08\x00\x00\x00<module>\x02\x00\x00\x00s\x02\x00\x00\x00\x0c\x03'
```

`__file__` contains the path of the compiled `.pyc`, not the `.py`
source file.
7 years ago
Alex Willmer 77d57a7e38 fakessh: Remove colon causing SyntaxError
fixes #58
7 years ago
David Wilson 658806bde8 fakessh: interruptible wait compatible with <2.7; closes #55 7 years ago
David Wilson b3491b190c master: Lazy-format more logging arguments, minor 3.x compat increments 7 years ago
Alex Willmer 0e7cc55e33 first stage: Remove/dedent else block
Since the above if block ends in a call to os.execv() this block will
only ever run when the if condition was false. Hence putting it in an
else clause is unnecessary.
7 years ago
Alex Willmer d1c10f64a5 first stage: Use string concatenation 7 years ago
Alex Willmer b490cde604 first stage: eliminate whitespace 7 years ago
Alex Willmer c7c0266e99 first stage: single letter variables 7 years ago
David Wilson 8cabba6965 Add first_stage_test to Travis. 7 years ago
David Wilson 32cf2e1a97 Sort .travis.yml 7 years ago
David Wilson 65defaa354 tests: initial first_stage_test. 7 years ago
David Wilson 3d0e8c36d2 issue #49: 2.x/3.x compatible decode.
Much uglier command line, but it works across major Python releases.
7 years ago
David Wilson 038ab04908 docs: convert paragraph to footnote. 7 years ago
David Wilson e3d2c8d649 issue #49: update howitworks.rst for command line change 7 years ago
David Wilson db9bec8720 Implement Alex's awesome idea of zlibbing the first stage too! Closes #49 7 years ago
Alex Willmer 8dcfb1b7f7 testlib: Auto negotiate Docker API version
Ubuntu 17.04 provides Docker 1.12.6, which has API version 1.24.
`dev_requirements.txt` specifies the docker-py 2.5.1, which by default
requests API version 1.30.

Hence when the SSH unit tests try to run the container specified in
`DockerizedSshDaemon` an error occurs

```
APIError: 400 Client Error: Bad Request ("client is newer than server
(client API version: 1.30, server API version: 1.24)")
```
7 years ago
Alex Willmer 94992940dd ssh_test: Correct hostname in SShTest.test_stream_name()
I presume that `u1704` is a relic of a bygone container/host.
7 years ago
Alex Willmer dfc7b85504 testlib: Wait for sshd before running tests
On Ubuntu 17.10 something (probably Docker) appears to be accepting
connections, before sshd is fully ready. This results in a race
condition, and hence connection errors for the first few tests (2-3 on
my laptop).

testlib.wait_for_port() checks not only that the port can be connected
to, but also something resembling the sshd banner is sent.

Fixes #51
7 years ago
David Wilson f8a84616d7 tests: stop responder_test spamming the logs 7 years ago
David Wilson 7389272dc4 tests: stop fakessh spamming the logs 7 years ago
Alex Willmer b7e7ff1055 gitignore: distutils output files 7 years ago
Alex Willmer 6107cf7096 setup: Trove classifiers
These will help with future PyPI discovery, and should make it clear
that Python 3.x is not (yet) supported.
7 years ago
Alex Willmer 1ead1fb077 setup: Add a hashbang
- Uses /usr/bin/env so it still works in e.g. a virtualenv
- Uses python2, rather than python3 to indicate mitogen currently being
2.x only.
7 years ago
Alex Willmer 528b012736 setup: Use correct packages declaration
py_packages is not a field know by distutils or setuptools. The closest
is `py_modules`, which perhaps what the erroneus line here started as.

Fixes #43
7 years ago
David Wilson 12423566da Bump time allowance for fakessh_test 7 years ago
David Wilson 0481c08beb Ensure _run_defer() fully executes at least once before shutdown
Without this, it's possible for Waker to be start_received() after the
shutdown signal has already been sent, resulting in 5 second delay
during shutdown.

Additionally mask EBADF during os.write() to waker's write side.
Necessary since nothing synchronizes writer threads from the broker
thread during shutdown. Could be done with a lock instead, but this is
cheaper.
7 years ago
David Wilson 419c8c810f Bump time allowance for ssh_test. 7 years ago
David Wilson 4ae2f5925b Bump time allowance for select_test. 7 years ago
David Wilson 828f60351b importer: Delete _get_module_via_parent entirely
Can't figure out what it's supposed to do any more, and can't find a
version of Ansible before August 2016 (when I wrote that code) that
seems to need it.

Add some more mitigations to avoid sending dylibs.
7 years ago
David Wilson 58102c8179 docs: waiting on multiple calls 7 years ago
David Wilson b1ad04330b docs: move Router.route() into Sphinx. 7 years ago