From 470effc6700e4c60700b49a59675603b37f9b9a6 Mon Sep 17 00:00:00 2001 From: Euxhen Hasanaj Date: Fri, 4 Aug 2023 15:29:42 -0400 Subject: [PATCH] Eh/code test coverage (#95) * Adding code coverage * Fix coverage testing * Switch from pytest to coverage * Adding circleci config * Adding circleci coverage config * remove unittest * com --- .circleci/config.yml | 42 +++++++++++----------------------- .github/workflows/unittest.yml | 34 --------------------------- 2 files changed, 13 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/unittest.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index e928823..fd6c983 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,39 +1,23 @@ -# This config was automatically generated from your source code -# Stacks detected: deps:python:. version: 2.1 + orbs: - python: circleci/python@2 + codecov: codecov/codecov@3.2.5 + jobs: - test-python: - # Install dependencies and run tests + test-api: docker: - - image: cimg/python:3.10-node + - image: cimg/python:3.10.2 steps: - checkout - - python/install-packages - - python/install-packages: - args: pytest - pkg-manager: pip - pypi-cache: false - run: - name: Run tests - command: pytest --junitxml=junit.xml - - store_test_results: - path: junit.xml - deploy: - # This is an example deploy job, not actually used by the workflow - docker: - - image: cimg/base:stable - steps: - # Replace this with steps to deploy to users + name: Install requirements + command: pip install -r requirements.txt - run: - name: deploy - command: '#e.g. ./deploy.sh' + name: Run tests and collect coverage + command: coverage run -m pytest --doctest-modules + - codecov/upload + workflows: - build-and-test: + build-test: jobs: - - test-python - # - deploy: - # requires: - # - test-python - + - test-api diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml deleted file mode 100644 index 356592c..0000000 --- a/.github/workflows/unittest.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Pytest - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Test with coverage and pytest - run: | - coverage run -m pytest --doctest-modules - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}