Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pomponchik committed Oct 9, 2023
1 parent 5c5a46e commit 8a82454
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests

on:
push

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install the library
shell: bash
run: python setup.py install

- name: Install dependencies
shell: bash
run: pip install -r requirements_dev.txt

- name: Run tests and show coverage on the command line
run: coverage run --source=astrologic --omit="*tests*" -m pytest --cache-clear && coverage report -m

- name: Upload reports to codecov
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
if: runner.os == 'Linux'
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
find . -iregex "codecov.*"
chmod +x codecov
./codecov -t ${CODECOV_TOKEN}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ build
.DS_Store
venv
test.py
.pytest_cache
Empty file added tests/units/__init__.py
Empty file.
Empty file.
13 changes: 13 additions & 0 deletions tests/units/decorators/test_tail_recursion_optimization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sys

from astrologic import no_recursion


def test_big_recursion():
@no_recursion
def c(b):
if b == sys.getrecursionlimit() * 10:
return b
return c(b + 1)

assert c(0) == sys.getrecursionlimit() * 10

0 comments on commit 8a82454

Please sign in to comment.