Commit Graph

92 Commits

Author SHA1 Message Date
Min RK
151acd5bec catch errors in cleanup 2018-04-09 15:16:05 +02:00
Min RK
23ca2039f6 run cleanup_after on ioloop
instead of directly on asyncio
2018-04-09 15:09:50 +02:00
Min RK
b291103592 fixup cleanup 2018-04-09 14:51:20 +02:00
Min RK
2952f62726 add cleanup_after fixture
function-scoped fixture for shutting down servers

avoids servers leaking into neighbor tests without having to teardown the app itself after every test
2018-04-09 14:24:29 +02:00
Tim Head
446d197cf7 Move auth state fixture to conftest 2018-03-27 10:02:59 +02:00
Min RK
b282ec73c7 no_patience doesn't quite work with zero timeout anymore
thanks to asyncio always waiting a finite time on any await
2018-03-12 18:18:47 +01:00
Min RK
5e14904205 fix a few unawaited calls to coroutines
asyncio is less forgiving about these than tornado
2018-03-12 18:18:46 +01:00
Min RK
015df7e060 unify mocking of tornado_settings
ensures that everywhere we access settings, it's the same dict
and not a copy
2018-03-12 14:23:00 +01:00
Min RK
e025d58f6e fix mocks for spawner config 2018-03-12 14:23:00 +01:00
Min RK
63ef6419cd add admin_access fixture 2018-03-12 14:23:00 +01:00
Min RK
9bf533b340 fixes when tests are run on asyncio
- need to explicitly instantiate asyncio eventloops in background threads
- remove some now-obsolete initialized checks in teardown
2018-02-01 14:56:40 +01:00
Min RK
88268bd76f test spawn_pending_count
make sure to cover various cases of spawn failure
so that failed spawns don't leak pending-spawn counts
2017-07-31 12:39:06 +02:00
Min RK
f05aecf5f9 test_api passes without threads
just put requests in a thread via `utils.async_requests`

eliminates db threads issue
2017-07-27 11:29:16 +02:00
Min RK
58f072e5af start MockHub without threads
everything's going to run with gen_test

need our own io_loop fixture that's module_scoped to go with our app fixture
2017-07-27 11:28:32 +02:00
Min RK
4b5aad41b1 make user.running a method
accept server names
2017-07-18 14:48:29 +02:00
Min RK
a6f1f6ea09 disconnect logging during MockHub cleanup
pytest appears to close captured FDs prematurely,
causing huge "I/O operation on closed file" tracebacks
whenever tests stop early due to a failure.

This should quiet the extra traceback, though it could potentially silence useful log messages during cleanup in rare cases
2017-06-06 15:28:19 +02:00
Min RK
226b6c40a5 improve waiting for service to start in mockservice fixture
- wait for proxy update before starting service
- wait for service server to respond to start before proceeding
2017-05-04 13:33:16 +02:00
Min RK
be8f847309 move proxy management to Proxy object
out of the Application
2017-05-04 11:13:19 +02:00
Min RK
d11c7ba4db cleanup more after mockservices 2017-04-05 15:53:48 +02:00
Min RK
5b1435081a remove redundant/unused code in mockservice fixture 2017-04-04 17:02:34 +02:00
Carol Willing
b5a600d488 Merge pull request #984 from minrk/spawner-shell
allow customization of spawn command
2017-02-17 10:43:31 -08:00
Min RK
3996fa00ef turn off database echo in tests
it's a bunch of noise
2017-02-15 11:29:48 +01:00
Carol Willing
576858b6ca Rename to mocked_app to avoid shadowing app 2017-02-14 18:55:02 -08:00
Carol Willing
5245670af1 Remove deprecated yield_fixture; add docstrings 2017-02-08 14:16:36 -08:00
Christian Barra
02090c953b fix errors, remove pep8 corrections 2017-01-03 14:10:46 +01:00
Min RK
ff92ac9dad more mocking in tests
avoids no_patience state leaking into other tests
2016-10-07 10:59:32 +02:00
Min RK
e9fc629285 only set service URL env if there's a URL to set
These fields are only relevant for services with a web endpoint
2016-09-21 12:39:07 +02:00
Min RK
5ad618bfc1 add API endpoint for services 2016-09-02 15:19:45 +02:00
Min RK
1c3102fd0a restore db echo in tests
while we are having weird db failures
2015-03-04 14:14:46 -08:00
Min RK
f81d4ba44c update tests with new default server ip ('')
and verify that starting a Spawner sets ip to localhost
2015-03-02 16:48:21 -08:00
Min RK
7082ea60ee fix filter check in Proxy.check_routes
and test that check_routes works as intended
2015-02-11 11:17:01 -08:00
Min RK
088893e3dc cleanup HTTP server in JupyterHub.stop
and cleanup MockHub instance in between uses
2015-02-08 10:16:46 -08:00
Min RK
fb7cc171c6 s/JupyterHubApp/JupyterHub/
users shouldn't need to know wtf Applications are
2014-11-25 19:55:24 -08:00
Min RK
40a99e61ac drop support for old Python, IPython < 3
Require IPython >= 3.0, Python >= 3.3
2014-11-02 15:51:06 -08:00
Scott Sanderson
8cfbe9b38e DEV: Close transactions at the end of HTTP Requests.
Fixes #84
2014-10-29 17:38:24 -04:00
Scott Sanderson
a34d514d66 BUG: Fix str/unicode warnings from SQLAlchemy on python 2.
When running with `reset_db=True` on python 2, several SQLAlchemy operations
were performed with bytes where unicode was expected, resulting in
warnings like the following.

```
/home/ssanderson/.virtualenvs/jupyterhub/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py:573:
SAWarning: Unicode type received non-unicodebind param value.
  param.append(processors[key](compiled_params[key]))
```

Fixes a few stray non-unicode literals and adds a unicode safe wrapper
for `getpass.getuser`.
2014-10-27 03:40:52 -04:00
MinRK
58f4d39372 use debug logging during testing 2014-10-14 11:45:23 -07:00
MinRK
970e4d2ce2 minor fixes to testing utils 2014-09-14 11:54:37 -07:00
MinRK
5c87461605 add mock utils to tests
basic testing framework to get starting writing and testing the REST API

including tests for the authorizations API,
the only API URL defined so far.
2014-09-13 16:11:22 -07:00
MinRK
67e12c1a5e use run_sync to run coroutines in sync contexts
allows using py.test stuff in spawner/auth tests
2014-09-12 15:58:48 -07:00
MinRK
534eee46fc rename db.py orm.py
less confusing to have self.db and orm.User
than self.db and db.User.
2014-08-25 15:10:28 -07:00
MinRK
c40b5699d7 use py.test fixtures 2014-08-25 11:44:33 -07:00