changeset 3439:b166a59b1724

tests, doc(testing): added `pytest-dependency` plugin to `backend_e2e` image + doc
author Goffi <goffi@goffi.org>
date Fri, 04 Dec 2020 12:37:38 +0100
parents 84fb41b515a1
children 53da72a17139
files doc/contribuing/testing.rst docker/backend_e2e/Dockerfile
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/doc/contribuing/testing.rst	Fri Dec 04 12:36:06 2020 +0100
+++ b/doc/contribuing/testing.rst	Fri Dec 04 12:37:38 2020 +0100
@@ -41,7 +41,6 @@
 
 In addition to pytest option, some flags can be set with the following arguments:
 
-
 ``--visual``
   Launch a VNC viewer to see in real time browser based tests. You must have ``vncviewer``
   executable available in your path (this is part of `TigerVNC`_)
@@ -73,7 +72,25 @@
 
   Then run a python console with given instructions
 
+It's also good to know that in the e2e test environment, the following pytest plugins are
+installed and used:
+
+`pytest-timeout`_
+  To avoid having test stuck, it's good to terminate them after a while. A timeout of 60s
+  is set by default for each test (lower value can give false negatives, as some e2e tests
+  can be long, notably with Selenium).
+
+`pytest-dependency`_
+  Even if good testing practice normally means that tests can be run independently, in the
+  case of e2e tests we are using a real environment, and some tests do create files,
+  PubSub nodes, accounts, etc. It would be resource consuming to delete then recreate them
+  only to have standalone tests, thus to keep tests short and simple, some of them must be
+  run in order. The *dependecy* plugin is used to manage that, and will skip tests if one
+  of their dependencies is failing. The markup help also to document the tests order.
+
 .. _TigerVNC: https://tigervnc.org
+.. _pytest-timeout: https://github.com/pytest-dev/pytest-timeout
+.. _pytest-dependency: https://github.com/RKrahl/pytest-dependency
 
 common fixtures
 ---------------
--- a/docker/backend_e2e/Dockerfile	Fri Dec 04 12:36:06 2020 +0100
+++ b/docker/backend_e2e/Dockerfile	Fri Dec 04 12:37:38 2020 +0100
@@ -44,7 +44,7 @@
 
 RUN \
     # pytest and its plugins
-    pip install pytest pytest-timeout \
+    pip install pytest pytest-timeout pytest-dependency \
     # needed to test jp
     sh \
     # needed to test libervia