README.rst 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ============================
  2. Antevents Tests
  3. ============================
  4. This directory contains unit tests for the antlab infrastructure and
  5. adapters. Use the script runtests.sh to run all the tests. If will stop
  6. on the first error it encounters (as signified by a non-zero return code
  7. from the test program).
  8. As much as possible, the tests are standalone and do not require external
  9. dependencies. However, tests of specific adapters will often require some
  10. software to be installed and configured. To support this, we do the following:
  11. 1. Any configuration variables (e.g. usernames, passwords, connect strings)
  12. go into the file config_for_tests.py. This file is NOT checked into
  13. git, since it may contain sensitive data. Instead copy the file
  14. example_config_for_tests.py to config_for_tests.py and adjust it for
  15. your environment.
  16. 2. Tests with external dependencies use the @unittest.skipUnless decorator
  17. to check for the dependencies and skip the test if the requirements are
  18. not met.
  19. Dependencies
  20. -------------
  21. Here are the commands used to install all the dependencies on Ubuntu::
  22. sudo apt-get install postgresql
  23. sudo apt-get install libpq-dev python3-dev
  24. pip install psycopg2
  25. # In the following, replace USER with your linux user name
  26. sudo -u postgres psql <<!
  27. create user USER;
  28. create database iot;
  29. grant all on database iot to USER;
  30. \q
  31. !
  32. sudo apt-get install mosquitto
  33. pip install paho-mqtt
  34. pip install hbmqtt