You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By utilizing `hatch`, the following commands are available to manage the development environment.
25
+
26
+
### Tests
27
+
28
+
| Command | Description |
29
+
| --- | --- |
30
+
|`hatch test`| Run Python tests using the current environment's Python version |
31
+
|`hatch test --all`| Run tests using all compatible Python and Django versions |
32
+
|`hatch test --python 3.9`| Run tests using a specific Python version |
33
+
|`hatch test --include "django=5.1"`| Run tests using a specific Django version |
34
+
|`hatch test -k test_backup_filter`| Run only a specific test |
35
+
36
+
??? question "What other arguments are available to me?"
37
+
38
+
The `hatch test` command is a wrapper for `pytest`. Hatch "intercepts" a handful of arguments, which can be previewed by typing `hatch test --help`.
39
+
40
+
Any additional arguments in the `test` command are directly passed on to pytest. See the [pytest documentation](https://docs.pytest.org/en/stable/reference/reference.html#command-line-flags) for what additional arguments are available.
41
+
42
+
### Linting and Formatting
43
+
44
+
| Command | Description |
45
+
| --- | --- |
46
+
|`hatch run lint:format`| Run formatters to fix code style |
47
+
|`hatch run lint:format-check`| Check code formatting without making changes |
48
+
|`hatch run lint:check`| Run all linters |
49
+
|`hatch run precommit:check`| Run all [`pre-commit`](https://pre-commit.com/) checks configured within this repository |
50
+
|`hatch run precommit:update`| Update the [`pre-commit`](https://pre-commit.com/) hooks configured within this repository |
51
+
52
+
??? tip "Configure your IDE for linting"
53
+
54
+
This repository uses `ruff` and `pylint` for linting and formatting.
55
+
56
+
You can install `ruff` as a plugin to your preferred code editor to create a similar environment.
57
+
58
+
### Functional Testing
59
+
60
+
| Command | Description |
61
+
| --- | --- |
62
+
|`hatch run functional:test`| Run end-to-end backup and restore tests |
63
+
64
+
The functional tests perform real database and media backup/restore cycles to ensure the commands work correctly.
65
+
66
+
### Documentation
67
+
68
+
| Command | Description |
69
+
| --- | --- |
70
+
|`hatch run docs:serve`| Start the [`mkdocs`](https://www.mkdocs.org/) server to view documentation locally |
71
+
|`hatch run docs:build`| Build the documentation |
72
+
73
+
### Environment Management
74
+
75
+
| Command | Description |
76
+
| --- | --- |
77
+
|`hatch build --clean`| Build the package from source |
78
+
|`hatch env prune`| Delete all virtual environments created by `hatch`|
79
+
|`hatch python install 3.12`| Install a specific Python version to your system |
80
+
81
+
??? tip "Check out Hatch for all available commands!"
82
+
83
+
This documentation only covers commonly used commands.
84
+
85
+
You can type `hatch --help` to see all available commands.
86
+
7
87
## Submit a bug, issue or enhancement
8
88
9
89
All communication are made with [GitHub issues](https://github.com/Archmonger/django-dbbackup/issues). Do not hesitate to open a
@@ -21,62 +101,26 @@ of requests we advise you to:
21
101
22
102
1. Fork the project and make a new branch
23
103
2. Make your changes with tests if possible and documentation if needed
24
-
3. Push changes to your fork repository and test it with Travis
25
-
4. If it succeeds, open a pull request
26
-
5. Bother us until we give you an answer
104
+
3. Run `hatch test` and `hatch run functional:test` to verify your changes
105
+
4. Run `hatch run lint:check` to ensure code quality
106
+
5. Push changes to your fork repository and test it with GitHub Actions
107
+
6. If it succeeds, open a pull request
108
+
7. Bother us until we give you an answer
27
109
28
110
!!! note
29
-
We advise you to launch it with Python 2 & 3 before push and try it in
30
-
Travis. DBBackup uses a lot of file operations, so breaks between Python
31
-
versions are easy.
32
-
33
-
## Test environment
34
-
35
-
We provides tools to help developers to quickly test and develop DBBackup.
36
-
There are 2 majors scripts:
37
-
38
-
*`runtests.py`: Unit tests launcher and equivalent of `manage.py` in
39
-
the test project.
40
-
*`functional.sh`: Shell script that use `runtests.py` to create a
41
-
database backup and restore it, the same with media, and test if they are
42
-
restored.
43
-
44
-
### `runtests.py`
45
-
46
-
You can test code on your local machine with the `runtests.py` script:
47
-
48
-
```bash
49
-
python runtests.py
50
-
```
51
-
52
-
But if argument are provided, it acts as `manage.py` so you can simply
53
-
launch some other command to test deeply, example:
54
-
55
-
```bash
56
-
# Enter in Python shell
57
-
python runtests.py shell
58
-
59
-
# Launch a particular test module
60
-
python runtests.py test dbbackup.tests.test_utils
61
-
```
62
-
63
-
All tests are stored in `dbbackup.tests`.
64
-
65
-
### `functional.sh`
66
-
67
-
It tests at a higher level if backup/restore mechanism is alright. It
68
-
becomes powerful because of the configuration you can give to it. See the next
69
-
chapter for explanation about it.
111
+
We recommend testing with multiple Python and Django versions using
112
+
`hatch test --all` before pushing. DBBackup uses a lot of file operations,
113
+
so breaks between versions are possible.
70
114
71
-
### Configuration
115
+
##Test environment configuration
72
116
73
117
DBBackup contains a test Django project at `dbbackup.tests` and its
74
118
`settings` module. This configuration takes care of the following
0 commit comments