You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

  1. # Prismedia AutoUpload
  2. This the implementation for the file handling of prismedia's autoupload feature.
  3. It consist of one file: `autoupload.py`. There is also a test file as `autoupload_test.py` which can be helpfull has to how to use this object.
  4. I am not a python expert and everything may change when integrating this project in Prismedia: function/variable name/case, interface, ...
  5. # Dependencies
  6. ```sh
  7. pip3 install toml
  8. ```
  9. # Tests
  10. Since there is no tests done for Prismedia, I choose `unittest` to do tests for this lib since it is present in the python standard library.
  11. Launch tests with
  12. ```sh
  13. python3 -m unittest
  14. ```
  15. # git hook
  16. To start tests automatically you can create a `pre-commit` file in `.git/hooks/` with the following content:
  17. ```sh
  18. #!/usr/bin/env bash
  19. # run tests
  20. python3 -m unittest discover . --failfast
  21. # unittest exists with 0 if all tests passed, 1 otherwise.
  22. tests_failed=$?
  23. if [ ${tests_failed} -eq 1 ]; then
  24. echo "Tests failed. Aborting commit"
  25. exit 1
  26. fi
  27. exit 0
  28. ```
  29. The hook should have execution right, `chmod 775 .git/hooks/pre-commit`.
  30. Maybe we can use the example here https://gist.github.com/orenshk/6cab23fcff847d704af7f3eec22b1ba6 as pre-commit hook to also format according to PEP8.