-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnoxfile.py
36 lines (27 loc) · 1.04 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Nox configuration file for managing test sessions and code quality checks."""
import nox
@nox.session(python="3.12")
def tests(session):
"""Run the tests with pytest.
This session performs the following steps:
1. Installs dependencies from requirements.txt.
2. Installs pytest and pytest-cov for running tests and generating code coverage.
3. Installs the package itself (if needed).
4. Runs pytest on the 'tests' directory.
Usage:
- To run this session, use: `nox -s tests`
"""
# Install dependencies from requirements.txt
session.install("-r", "requirements.txt")
session.install("pytest", "pytest-cov")
# Run pytest on the 'tests' directory
session.run("pytest", "tests")
@nox.session(python="3.12")
def ruff(session):
"""Run ruff & black code formatter."""
# Install black, ruff
session.install("black", "ruff")
# Run ruff linter
session.run("ruff", "check", "src", "scripts", "app.py")
# Run black linter
session.run("black", "--check", "src", "scripts", "app.py")