Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move src/dailyai/tests to tests #80

Merged
merged 5 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,37 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
id: setup_python
uses: actions/setup-python@v4
with:
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
run: sudo apt-get install -y portaudio19-dev
- name: Install basic dependencies
- name: Setup virtual environment
run: |
python -m venv .venv
- name: Install basic Python dependencies
run: |
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build project
run: |
source .venv/bin/activate
python -m build
- name: Install project and other dependencies
- name: Install project and other Python dependencies
run: |
source .venv/bin/activate
pip install --editable .
- name: Test with pytest
run: |
source .venv/bin/activate
pip install pytest
pytest --doctest-modules --ignore-glob="*to_be_updated*" src/dailyai
pytest --doctest-modules --ignore-glob="*to_be_updated*" src tests
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ If you want to use this package from another directory, you can run:
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

This project uses strict [PEP 8](https://peps.python.org/pep-0008/) formatting.
Expand All @@ -116,13 +130,7 @@ You can use [use-package](https://github.com/jwiegley/use-package) to install [p
(setq py-autopep8-options '("-a" "-a")))
```

If you don't have it already, you also need to install [autopep8](https://pypi.org/project/autopep8/):

```
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.
`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.

```elisp
(use-package pyvenv-auto
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ Website = "https://daily.co"
[tool.setuptools.packages.find]
# All the following settings are optional:
where = ["src"]

[tool.pytest.ini_options]
pythonpath = ["src"]
Empty file removed src/dailyai/tests/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading