Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Start using tox
Browse files Browse the repository at this point in the history
Use tox for managing different python virtual environments
and running tests. By integrating tox in the CI, the python
environment in the CI is reproducible locally.

Update the README.

Signed-off-by: Teodora Sechkova <[email protected]>
  • Loading branch information
sechkova committed Feb 8, 2022
1 parent 798f373 commit 0ff2480
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/github-actions-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,33 @@ name: test
on : [pull_request, push]
jobs:
mcat-action-test:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest]
toxenv: [py]

env:
# see tox.ini
TOXENV: ${{ matrix.toxenv }}

runs-on: ${{ matrix.os }}
steps:
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Checkout repository code
uses: actions/checkout@v2

- name: Setup python
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: ${{ matrix.python-version }}
architecture: 'x64'

- name: Install python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pip install --upgrade tox
- name: Test
run: |
cd ml-conversational-analytic-tool
python -m unittest discover -s tests
- name: Run tox (${{ env.TOXENV }})
run: tox
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ create isolated Python environment is recommended for this project.
```python
python -m unittest tests/<file_name>
```
8. By using tox
```python
python -m pip install --upgrade tox
tox
```

The libraries used within the project are available in the [requirements.txt](./requirements.txt).

Expand Down
17 changes: 17 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py
skipsdist=True

[testenv]
changedir =
{toxinidir}
deps =
-r{toxinidir}/requirements.txt

commands =
python -m unittest discover -s tests

0 comments on commit 0ff2480

Please sign in to comment.