mirror of
https://github.com/jongracecox/anybadge.git
synced 2026-01-05 11:51:21 +01:00
Add invoke test.cli task
This runs CLI tests against locally installed package. Also includes documentation updates.
This commit is contained in:
@@ -192,9 +192,26 @@ After running tests, inspect the console output to see if there were any errors
|
||||
|
||||
#### Adding tests
|
||||
|
||||
The PyPi tests are implemented in `docker/test/run_pypi_tests.sh`. If you find a bug, then adding a test to this script
|
||||
The PyPi tests are implemented in `docker/test/shell_tests.sh`. If you find a bug, then adding a test to this script
|
||||
could be useful, and quicker than adding a unittest.
|
||||
|
||||
### CLI tests
|
||||
|
||||
To run the CLI tests that execute as part of the `inv test.pypi` against a local install you can use:
|
||||
|
||||
```bash
|
||||
inv test.cli
|
||||
```
|
||||
|
||||
If you would like to build, install and run the cli tests against a local install (which can be useful when editing
|
||||
CLI code), you can use:
|
||||
|
||||
```bash
|
||||
inv build && inv install && inv test.cli
|
||||
```
|
||||
|
||||
Note that this will force install the built wheel from the project `dist/` directory over any existing local install.
|
||||
|
||||
## Documentation
|
||||
|
||||
The `README.md` file contains a table showing example badges for the different built-in colors. If you modify the
|
||||
|
||||
@@ -52,3 +52,20 @@ def pypi(c, version="latest"):
|
||||
f"docker run -e VERSION={version} -v {test_files.absolute()}:/test_files test-anybadge:latest /work/run_pypi_tests.sh",
|
||||
shell=True,
|
||||
)
|
||||
|
||||
|
||||
@task
|
||||
def cli(c, version="latest"):
|
||||
"""Run CLI tests against currently installed version."""
|
||||
print("Running tests against currently installed version...")
|
||||
|
||||
clean(c)
|
||||
test_files = PROJECT_DIR / Path("test_files")
|
||||
test_files.mkdir(exist_ok=True)
|
||||
|
||||
shell_test = PROJECT_DIR / Path("docker/test/shell_tests.sh")
|
||||
|
||||
subprocess.run(
|
||||
f'SOURCE_DIR="{shell_test.parent}" PROJECT_DIR="{PROJECT_DIR}" {shell_test}',
|
||||
shell=True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user