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

feat: add nox for repeatable usage #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 12 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To start working on this project, here are some guidelines to set up your enviro
3. [Install poetry](https://python-poetry.org/docs/#installation)
4. Activate virtualenv`poetry shell`
5. Install dependencies: `poetry install`
6. Run `pre-commit install --install-hooks` to install [precommit hooks][pre-commit]
6. Run `poetry run pre-commit install --install-hooks` to install [precommit hooks][pre-commit]

After having installed pre-commit, before each commit, pre-commit hooks are run to:
* check code formatting
Expand All @@ -21,6 +21,17 @@ After having installed pre-commit, before each commit, pre-commit hooks are run
* check code typing
* find common security issues in Python code

## Nox usage

Nox tool can handle different session to simplify contributing on a project.
Basic noxfile was added to locally run pre-commit checks and pytest:
```bash
poetry run nox -e test
```

```bash
poetry run nox -e pre_commit
```

## Tests

Expand Down
21 changes: 21 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import annotations

import nox


@nox.session()
def pre_commit(session):
session.run("poetry", "run", "pre-commit", "run", "--all-files", external=True)


@nox.session()
def test(session):
session.run(
"poetry",
"run",
"pytest",
"--cov=pyartifactory",
"--cov-branch",
"--cov-report=xml",
external=True,
)
Loading