Merge pull request #80 from daily-co/move-src-daily-tests-to-tests

move src/dailyai/tests to tests
This commit is contained in:
Aleix Conchillo Flaqué
2024-03-21 00:27:07 +08:00
committed by GitHub
11 changed files with 36 additions and 10 deletions

View File

@@ -22,22 +22,37 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
id: setup_python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: '3.10' python-version: '3.10'
- name: Cache virtual environment
uses: actions/cache@v3
with:
# TODO: we are hashing requirements.txt but that doesn't contain all
# our dependencies pinned.
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements.txt') }}
path: .venv
- name: Install system packages - name: Install system packages
run: sudo apt-get install -y portaudio19-dev run: sudo apt-get install -y portaudio19-dev
- name: Install basic dependencies - name: Setup virtual environment
run: | run: |
python -m venv .venv
- name: Install basic Python dependencies
run: |
source .venv/bin/activate
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Build project - name: Build project
run: | run: |
source .venv/bin/activate
python -m build python -m build
- name: Install project and other dependencies - name: Install project and other Python dependencies
run: | run: |
source .venv/bin/activate
pip install --editable . pip install --editable .
- name: Test with pytest - name: Test with pytest
run: | run: |
source .venv/bin/activate
pip install pytest pip install pytest
pytest --doctest-modules --ignore-glob="*to_be_updated*" src/dailyai pytest --doctest-modules --ignore-glob="*to_be_updated*" src tests

View File

@@ -99,6 +99,20 @@ If you want to use this package from another directory, you can run:
pip install path_to_this_repo pip install path_to_this_repo
``` ```
### Running tests
To run tests you need to install `pytest`:
```
pip install pytest
```
Then, from the root directory, run:
```
pytest --doctest-modules --ignore-glob="*to_be_updated*" src tests
```
## Setting up your editor ## Setting up your editor
This project uses strict [PEP 8](https://peps.python.org/pep-0008/) formatting. This project uses strict [PEP 8](https://peps.python.org/pep-0008/) formatting.
@@ -116,13 +130,7 @@ You can use [use-package](https://github.com/jwiegley/use-package) to install [p
(setq py-autopep8-options '("-a" "-a"))) (setq py-autopep8-options '("-a" "-a")))
``` ```
If you don't have it already, you also need to install [autopep8](https://pypi.org/project/autopep8/): `autopep8` was installed in the `venv` environment described before, so you should be able to use [pyvenv-auto](https://github.com/ryotaro612/pyvenv-auto) to automatically load that environment inside Emacs.
```
pip install autopep8
```
If use install `autopep8` in the `venv` environment described before, you can use [pyvenv-auto](https://github.com/ryotaro612/pyvenv-auto) to automatically load the virtual environment inside Emacs.
```elisp ```elisp
(use-package pyvenv-auto (use-package pyvenv-auto

View File

@@ -45,3 +45,6 @@ Website = "https://daily.co"
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
# All the following settings are optional: # All the following settings are optional:
where = ["src"] where = ["src"]
[tool.pytest.ini_options]
pythonpath = ["src"]