Skip to content

Commit 520cee2

Browse files
authored
Merge pull request #80 from daily-co/move-src-daily-tests-to-tests
move src/dailyai/tests to tests
2 parents 5fc21a7 + a189e26 commit 520cee2

11 files changed

+36
-10
lines changed

.github/workflows/tests.yaml

+18-3
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,37 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v4
2424
- name: Set up Python
25+
id: setup_python
2526
uses: actions/setup-python@v4
2627
with:
2728
python-version: '3.10'
29+
- name: Cache virtual environment
30+
uses: actions/cache@v3
31+
with:
32+
# TODO: we are hashing requirements.txt but that doesn't contain all
33+
# our dependencies pinned.
34+
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements.txt') }}
35+
path: .venv
2836
- name: Install system packages
2937
run: sudo apt-get install -y portaudio19-dev
30-
- name: Install basic dependencies
38+
- name: Setup virtual environment
39+
run: |
40+
python -m venv .venv
41+
- name: Install basic Python dependencies
3142
run: |
43+
source .venv/bin/activate
3244
python -m pip install --upgrade pip
3345
pip install -r requirements.txt
3446
- name: Build project
3547
run: |
48+
source .venv/bin/activate
3649
python -m build
37-
- name: Install project and other dependencies
50+
- name: Install project and other Python dependencies
3851
run: |
52+
source .venv/bin/activate
3953
pip install --editable .
4054
- name: Test with pytest
4155
run: |
56+
source .venv/bin/activate
4257
pip install pytest
43-
pytest --doctest-modules --ignore-glob="*to_be_updated*" src/dailyai
58+
pytest --doctest-modules --ignore-glob="*to_be_updated*" src tests

README.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ If you want to use this package from another directory, you can run:
9999
pip install path_to_this_repo
100100
```
101101

102+
### Running tests
103+
104+
To run tests you need to install `pytest`:
105+
106+
```
107+
pip install pytest
108+
```
109+
110+
Then, from the root directory, run:
111+
112+
```
113+
pytest --doctest-modules --ignore-glob="*to_be_updated*" src tests
114+
```
115+
102116
## Setting up your editor
103117

104118
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
116130
(setq py-autopep8-options '("-a" "-a")))
117131
```
118132

119-
If you don't have it already, you also need to install [autopep8](https://pypi.org/project/autopep8/):
120-
121-
```
122-
pip install autopep8
123-
```
124-
125-
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.
133+
`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.
126134

127135
```elisp
128136
(use-package pyvenv-auto

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ Website = "https://daily.co"
4545
[tool.setuptools.packages.find]
4646
# All the following settings are optional:
4747
where = ["src"]
48+
49+
[tool.pytest.ini_options]
50+
pythonpath = ["src"]

src/dailyai/tests/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)