Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ pip install --editable .["test"]

To run the tests, run `pytest` in the virtual environment. This will run everything except the fuzzer, which can be run with `python3 tests/fuzz.py`.

**Note**: It is recommended to run `./run_checks.sh` before commiting code. This will run pytest, pylint, and check the formatting, telling you what went wrong before your code hits CI.

## Usage

After adding the Uno bot to a Discord server, you can start your own Uno games!
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies = ["discord", "dotenv", "pytest"]
test = [
"pytest",
"atheris",
"black",
]

[tool.setuptools]
Expand Down
23 changes: 23 additions & 0 deletions run_checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

python3 -m venv env

./env/bin/pip3 install --editable .["test"]

if ! ./env/bin/pytest; then
echo -e "\e[31mpytest error!\e[0m"
exit 1
fi

if ! ./env/bin/pylint $(git ls-files '*.py'); then
echo "\e[31mpylint error!\e[0m"
exit 1
fi

if ! ./env/bin/black --check $(git ls-files '*.py'); then
echo "\e[31mFormatting error!\e[0m"
echo "Run ./env/bin/black --check $(git ls-files '*.py') to fix"
exit 1
fi

echo "\n\e[32mAll checks passed!\e[0m"
Loading