conftest.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright (c) Jupyter Development Team.
  2. # Distributed under the terms of the Modified BSD License.
  3. import pytest
  4. from jupyterlab import __version__
  5. from jupyterlab.handlers.announcements import (
  6. CheckForUpdate,
  7. CheckForUpdateHandler,
  8. NewsHandler,
  9. check_update_handler_path,
  10. news_handler_path,
  11. )
  12. @pytest.fixture
  13. def labserverapp(jp_serverapp, make_labserver_extension_app):
  14. app = make_labserver_extension_app()
  15. app._link_jupyter_server_extension(jp_serverapp)
  16. app.handlers.extend(
  17. [
  18. (
  19. r"/custom/(.*)(?<!\.js)$",
  20. jp_serverapp.web_app.settings["static_handler_class"],
  21. {
  22. "path": jp_serverapp.web_app.settings["static_custom_path"],
  23. "no_cache_paths": ["/"], # don't cache anything in custom
  24. },
  25. ),
  26. (
  27. check_update_handler_path,
  28. CheckForUpdateHandler,
  29. {
  30. "update_checker": CheckForUpdate(__version__),
  31. },
  32. ),
  33. (
  34. news_handler_path,
  35. NewsHandler,
  36. {
  37. "news_url": "https://dummy.io/feed.xml",
  38. },
  39. ),
  40. ]
  41. )
  42. app.initialize()
  43. return app