forked from UNICT-DMI/Telegram-DMI-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add unit tests config and examples (UNICT-DMI#212)
* feat: add unit tests config and examples * chore: update github action conf * chore: main -> master * chore: update CI, run doc job only for master * chore: separate workflow * chore: update doc.yml * chore: update requirements_dev.txt
- Loading branch information
Showing
19 changed files
with
88 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
omit = tests/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: DMI_bot_deploy | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths-ignore: | ||
- "README.md" | ||
- "docs/**" | ||
|
||
jobs: | ||
doc: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9.7 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9.7 | ||
- name: Install dependencies for requirements and testing | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install sphinx sphinx_rtd_theme sphinx_autodoc_typehints | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi | ||
- name: Setup enviroment | ||
run: | | ||
mv config/settings.yaml.dist config/settings.yaml | ||
mv data/DMI_DB.db.dist data/DMI_DB.db | ||
- name: Sphinx build | ||
run: | | ||
sphinx-build -b html docs/source docs/build/docs | ||
echo "# Telegram DMI bot documentation" > docs/build/README.md | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: docs/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,11 @@ on: | |
paths-ignore: | ||
- "README.md" | ||
- "docs/**" | ||
pull_request: | ||
branches: [master] | ||
paths-ignore: | ||
- "README.md" | ||
- "docs/**" | ||
|
||
jobs: | ||
test: | ||
|
@@ -37,37 +42,7 @@ jobs: | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest | ||
doc: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9.7 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9.7 | ||
- name: Install dependencies for requirements and testing | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install sphinx sphinx_rtd_theme sphinx_autodoc_typehints | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi | ||
- name: Setup enviroment | ||
run: | | ||
mv config/settings.yaml.dist config/settings.yaml | ||
mv data/DMI_DB.db.dist data/DMI_DB.db | ||
- name: Sphinx build | ||
run: | | ||
sphinx-build -b html docs/source docs/build/docs | ||
echo "# Telegram DMI bot documentation" > docs/build/README.md | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: docs/build | ||
- name: Unit test | ||
run: pytest tests/unit/ | ||
# - name: End-to-end test | ||
# run: pytest tests/e2e/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
pytest==6.2.5 | ||
pytest | ||
Telethon==1.23.0 | ||
pytest-asyncio==0.16.0 | ||
pytest-asyncio==0.16.0 | ||
pytest-mock | ||
pytest-cov |
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from module.data.professor import Professor | ||
|
||
def test_professor_table() -> None: | ||
professor = Professor() | ||
assert professor.table == "professors" | ||
|
||
def test_professor_columns() -> None: | ||
professor = Professor() | ||
assert professor.columns == ("ID", "ruolo", "nome", "scheda_dmi", "fax", "telefono", "email", "ufficio", "sito") |