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.

README.md 1.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Public APIs Scripts
  2. This directory contains all validation and testing scripts used by Public APIs.
  3. ```bash
  4. scripts
  5. │ github_pull_request.sh # used to validate changes of a pull request
  6. │ requirements.txt # contains dependencies of validate package
  7. ├───tests # contains all unit tests from the validate package
  8. │ test_validate_format.py
  9. │ test_validate_links.py
  10. └───validate # validate package
  11. format.py
  12. links.py
  13. ```
  14. ## Install dependencies
  15. You must have [python](https://www.python.org/) installed to use these scripts.
  16. it is also necessary to install the validation package dependencies, use [pip package manager](https://pypi.org/project/pip/) for this:
  17. ```bash
  18. $ python -m pip install -r scripts/requirements.txt
  19. ```
  20. ## Run validations
  21. To run format validation on the `README.md` file, being in the root directory of public-apis, run:
  22. ```bash
  23. $ python scripts/validate/format.py README.md
  24. ```
  25. To run link validation on the `README.md` file, being in the root directory of public-apis, run:
  26. ```bash
  27. $ python scripts/validate/links.py README.md
  28. ```
  29. As there are many links to check, this process can take some time. If your goal is not to check if the links are working, you can only check for duplicate links. Run:
  30. ```bash
  31. $ python scripts/validate/links.py README.md -odlc
  32. ```
  33. *`-odlc` is an abbreviation of `--only_duplicate_links_checker`*
  34. ## Running Tests
  35. To run all tests it is necessary to change to the scripts directory:
  36. ```bash
  37. $ cd scripts
  38. ```
  39. then run:
  40. ```bash
  41. $ python -m unittest discover tests/ --verbose
  42. ```
  43. To run only the format tests, run:
  44. ```bash
  45. $ python -m unittest discover tests/ --verbose --pattern "test_validate_format.py"
  46. ```
  47. To run only the links tests, run:
  48. ```bash
  49. $ python -m unittest discover tests/ --verbose --pattern "test_validate_links.py"
  50. ```