Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: code coverage work with poetry and add coverage.json gitignore #254

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
35e79e0
fix: cover command shows the coverage of the gator files
hannahb09 Nov 11, 2024
f625553
fix: poetry run task coverage works
hannahb09 Nov 11, 2024
a84ebe8
fix: code coverage works with poetry and coverage.json gets ignored
hannahb09 Nov 22, 2024
859f576
fix: delete coverage.json
hannahb09 Nov 22, 2024
4d4a41c
fix: new poetry to avoid linting issue
hannahb09 Nov 22, 2024
3408a09
fix: change the coverage command to 90%
hannahb09 Nov 22, 2024
22be16f
fix: commit poetry
hannahb09 Dec 5, 2024
dc86651
fix: change python version
hannahb09 Dec 5, 2024
9c86a2a
fix: python and poetry version
hannahb09 Dec 5, 2024
c264d4c
fix: linting coverage issue
hannahb09 Dec 6, 2024
9037af0
fix: update python number
hannahb09 Dec 6, 2024
0611741
chore: re install poetry
hannahb09 Dec 6, 2024
90e7706
fix: update poetry numbers
hannahb09 Dec 6, 2024
34e1670
fix: test vars are seperate from cmd
hannahb09 Dec 6, 2024
a5ba475
fix: coverage linting issue
hannahb09 Dec 6, 2024
8690674
fix: python number
hannahb09 Dec 6, 2024
2637d35
fix: linting issue comment out test_checkers.py
hannahb09 Dec 6, 2024
097cefa
fix: change linting in main
hannahb09 Dec 6, 2024
f3fc5a0
fix: linting
hannahb09 Dec 6, 2024
122759b
fix: linting
hannahb09 Dec 6, 2024
6bdebc1
fix: add ruff, symbex and mypy dependencies
hannahb09 Dec 6, 2024
df1c817
chore: readd poetry
hannahb09 Dec 6, 2024
ab66383
fix: add pyyaml
hannahb09 Dec 6, 2024
29216bb
fix: resolve linting issues with import block and long docstrings
suppo01 Dec 10, 2024
4b93f34
fix: remove unused variables to resolve linting errors
suppo01 Dec 10, 2024
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
9 changes: 7 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[coverage:report]
skip_empty = true
[run]
omit=test/*
include=gator*
relative_files=true
source=./gator
[json]
show_contexts=True
pretty_print=True
36 changes: 11 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Python 3.8
- name: Setup Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.11"
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.13
poetry-version: 1.5.1
- name: Setup Poetry
run: |
poetry config virtualenvs.create true
Expand All @@ -34,7 +34,6 @@ jobs:
run: poetry run task lint --check
- name: Lint writing
uses: actionshub/markdownlint@main

test:
# Test uses a strategy matrix to ensure that sufficient platform test
# coverage is reached. For this configuration, we run the latest Ubuntu
Expand All @@ -51,14 +50,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.10"]
python-version: ["3.11"]
include:
- os: macos-latest
python-version: "3.9"
python-version: "3.11"
- os: windows-latest
python-version: "3.8"
python-version: "3.11"
env:
# These environment variables are passed to CodeCov to identify each build
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
Expand All @@ -69,29 +67,17 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2.1.4
uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.1.13
poetry-version: 1.5.1
- name: Setup Poetry
run: |
poetry --version
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry env info
- name: Install dependencies
run: poetry install --no-interaction --no-ansi
- name: Execute tests
# We need to ensure that the cover-win script is run for Windows, so
# this Action runs different commands based on the runner's operating
# system.
uses: knicknic/os-specific-run@v1
with:
linux: poetry run task cover
macos: poetry run task cover
windows: poetry run task cover-win
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
fail_ci_if_error: true
if: matrix.os != 'windows-latest'
run: poetry run task test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
coverage.json
*,cover
.hypothesis/
*.mo
Expand Down
1,563 changes: 934 additions & 629 deletions poetry.lock

Large diffs are not rendered by default.

56 changes: 45 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,70 @@ packages = [{ include = "gator" }, { include = "gatorgrader.py" }]
gatorgrader = "gatorgrader:main"

[tool.poetry.dependencies]
python = ">=3.7.2,<4.0"
python = "^3.11"
GitPython = "^3.1.27"
requests = "^2.28.1"
commonmark = "^0.9.1"
num2words = "^0.5.10"
pluginbase = "^1.0.1"
pyyaml = ">=6.0.2"

[tool.poetry.dev-dependencies]
pylint = "^2.14.5"
black = "^22.6.0"
pytest = "^7.1.2"
codecov = "^2.1.12"
pytest = "^8.1.1"
pytest-json-report = "^1.5.0"
coverage = "^7.4.3"
flake8 = "^4.0.1"
pytest-cov = "^3.0.0"
pytest-cov = "^4.1.0"
pytest-sugar = "^0.9.5"
bandit = "^1.7.4"
pydocstyle = "^6.1.1"
radon = "^5.1.0"
xenon = "^0.9.0"
snoop = "^0.4.1"
taskipy = "^1.10.2"
taskipy = "^1.13.0"
toml = "^0.10.2"

[tool.poetry.group.dev.dependencies]
ruff = "^0.6.8"
symbex = "^1.4"
mypy = "^1.11.2"

[tool.taskipy.variables]
project = "gatorgrader"
tests = "tests"
test-silent-command = { var = "pytest -x --show-capture=no", recursive = true }
test-silent-not-randomly-command = { var = "pytest -x --show-capture=no -p no:randomly", recursive = true }
test-command = { var = "pytest -x -s -vv", recursive = true}
test-not-fuzz-command = {var = "pytest -x -s -vv -m \"not fuzz\"", recursive = true}
check-command = { var = "ruff check {project} {tests}", recursive = true }
coverage-test-command = "pytest -s --cov-context=test --cov-fail-under=90 --cov-config .coveragerc --cov-report term-missing --cov-report json --cov --cov-branch"
coverage-test-command-silent = "pytest -x --show-capture=no --cov-config .coveragerc --cov-report term-missing --cov-report json --cov --cov-branch"
developer-test-command = "pytest -x -s"
developer-test-silent-command = "pytest -x --show-capture=no"
fixformat-command = { var = "ruff format {project} {tests}", recursive = true }
format-command = { var = "ruff format --check {project} {tests}", recursive = true }
symbex-typed-command = {var = "symbex -s --untyped -d {project} --check", recursive = true}
symbex-documented-command = {var = "symbex -s --undocumented -d {project} --check", recursive = true}
mypy-command = {var = "mypy {project}", recursive = true}

[tool.taskipy.tasks]
test = "./scripts/test.sh"
cover = "./scripts/cover.sh"
lint = "./scripts/lint.sh"
test-win = 'scripts\\test.bat'
cover-win = 'scripts\\cover.bat'
lint-win = 'scripts\\lint.bat'
all = "task lint && task test"
lint = "task format && task check && task mypy && task symbex"
check = { cmd = "{check-command}", help = "Run the ruff linting checks", use_vars = true }
coverage = { cmd = "{coverage-test-command}", help = "Run test coverage monitoring", use_vars = true }
coverage-silent = { cmd = "{coverage-test-command-silent}", help = "Run test coverage monitoring", use_vars = true }
format = { cmd = "{format-command}", help = "Run the ruff formatter on source code", use_vars = true }
format-fix = { cmd = "{fixformat-command}", help = "Run the ruff formatter to fix source code", use_vars = true }
mypy = { cmd = "{mypy-command}", help = "Run the mypy type checker for potential type errors", use_vars = true }
symbex = "task symbex-typed && task symbex-documented"
symbex-typed = { cmd = "{symbex-typed-command}", help = "Run symbex for fully typed functions", use_vars = true }
symbex-documented = { cmd = "{symbex-documented-command}", help = "Run symbex for documentation", use_vars = true }
test-not-fuzz = { cmd = "{test-not-fuzz-command}", help = "Run the pytest test suite using order randomization and test distribution" }
test = { cmd = "{test-command}", help = "Run the pytest test suite using order randomization and test distribution", use_vars = true }
test-silent = { cmd = "{test-silent-command}", help = "Run the pytest test suite without showing output", use_vars = true }
test-silent-not-randomly = { cmd = "{test-silent-no-command}", help = "Run the pytest test suite without showing output and order randomization", use_vars = true }

[build-system]
requires = ["poetry-core"]
Expand Down
4 changes: 0 additions & 4 deletions scripts/cover.bat

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/cover.sh

This file was deleted.

83 changes: 0 additions & 83 deletions scripts/lint.bat

This file was deleted.

68 changes: 0 additions & 68 deletions scripts/lint.sh

This file was deleted.

Loading
Loading