pytest clednup

pull/187/head
evelynmitchell 1 year ago
parent e922045cf0
commit 95ff1f8be0

@ -20,9 +20,11 @@ jobs:
python-version: 3.x python-version: 3.x
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: |
pip install -r requirements.txt
pip install pytest
- name: Run tests and checks - name: Run tests and checks
run: | run: |
find tests/ -name "*.py" | xargs pytest pytest
pylint swarms pylint swarms

@ -38,4 +38,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest - name: Test with pytest
run: | run: |
find ./tests -name '*.py' -exec pytest {} \; pytest

@ -19,7 +19,9 @@ jobs:
python-version: 3.x python-version: 3.x
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: |
pip install -r requirements.txt
pip install pytest
- name: Run unit tests - name: Run unit tests
run: find tests/ -name "*.py" | xargs pytest run: pytest

@ -21,13 +21,15 @@ jobs:
python-version: '3.10' python-version: '3.10'
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: |
pip install -r requirements.txt
pip install pytest
- name: Run Python unit tests - name: Run Python unit tests
run: python3 -m unittest tests/ run: pytest
- name: Verify that the Docker image for the action builds - name: Verify that the Docker image for the action builds
run: docker build . --file Dockerfile run: docker build . --file Dockerfile
- name: Verify integration test results - name: Verify integration test results
run: find tests/ -name "*.py" | xargs pytest run: pytest

@ -72,7 +72,6 @@ pre-commit --version
Now when you make a git commit, the black code formatter and ruff linter will run. Now when you make a git commit, the black code formatter and ruff linter will run.
Furthermore, we have integrated a pre-commit GitHub Action into our workflow. This means that with every pull request opened, the pre-commit checks will be automatically enforced, streamlining the code review process and ensuring that all contributions adhere to our quality standards. Furthermore, we have integrated a pre-commit GitHub Action into our workflow. This means that with every pull request opened, the pre-commit checks will be automatically enforced, streamlining the code review process and ensuring that all contributions adhere to our quality standards.
To run the pre-commit tool, follow these steps: To run the pre-commit tool, follow these steps:
@ -124,13 +123,13 @@ You can learn more about mkdocs on the [mkdocs website](https://www.mkdocs.org/)
## 🧪 tests ## 🧪 tests
- Run all the tests in the tests folder - Run all the tests in the tests folder
`find ./tests -name '*.py' -exec pytest {} \;` ```pytest```
## Code Quality ## Code Quality
`quality.sh` runs 4 different code formatters for ultra reliable code cleanup using Autopep8, Black, Ruff, YAPF `code-quality.sh` runs 4 different code formatters for ultra reliable code cleanup using Autopep8, Black, Ruff, YAPF
1. Open your terminal. 1. Open your terminal.
2. Change directory to where `quality.sh` is located using `cd` command: 2. Change directory to where `code-quality.sh` is located using `cd` command:
```sh ```sh
cd /path/to/directory cd /path/to/directory
``` ```
@ -142,17 +141,17 @@ You can learn more about mkdocs on the [mkdocs website](https://www.mkdocs.org/)
4. Run the script: 4. Run the script:
```sh ```sh
./quality.sh ./code-quality.sh
``` ```
If the script requires administrative privileges, you might need to run it with `sudo`: If the script requires administrative privileges, you might need to run it with `sudo`:
```sh ```sh
sudo ./quality.sh sudo ./code-quality.sh
``` ```
Please replace `/path/to/directory` with the actual path where the `quality.sh` script is located on your system. Please replace `/path/to/directory` with the actual path where the `code-quality.sh` script is located on your system.
If you're asking for a specific content or functionality inside `quality.sh` related to YAPF or other code quality tools, you would need to edit the `quality.sh` script to include the desired commands, such as running YAPF on a directory. The contents of `quality.sh` would dictate exactly what happens when you run it. If you're asking for a specific content or functionality inside `code-quality.sh` related to YAPF or other code quality tools, you would need to edit the `code-quality.sh` script to include the desired commands, such as running YAPF on a directory. The contents of `code-quality.sh` would dictate exactly what happens when you run it.
## 📄 license ## 📄 license

@ -13,7 +13,7 @@ black --experimental-string-processing swarms/
# Run ruff on the 'swarms' directory. # Run ruff on the 'swarms' directory.
# Add any additional flags if needed according to your version of ruff. # Add any additional flags if needed according to your version of ruff.
#ruff --unsafe_fix ruff --unsafe_fix
# YAPF # YAPF
yapf --recursive --in-place --verbose --style=google --parallel swarms yapf --recursive --in-place --verbose --style=google --parallel swarms

@ -29,4 +29,4 @@ RUN pip install swarms
RUN pip install pytest RUN pip install pytest
# Run pytest on all tests in the tests directory # Run pytest on all tests in the tests directory
CMD find ./tests -name '*.py' -exec pytest {} + CMD pytest

Loading…
Cancel
Save