Skip to content

Commit

Permalink
docs: update readme (#295)
Browse files Browse the repository at this point in the history
Updates the README.md with steps to run the testing suite locally
  • Loading branch information
FredrikOseberg authored Nov 29, 2023
1 parent a0dfabd commit f4679ab
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,71 @@ print(variant)
```

For more information about variants, see the [Variant documentation](https://docs.getunleash.io/advanced/toggle_variants).

## Developing

For development, you'll need to setup the environment to run the tests. This repository is using
tox to run the test suite to test against multiple versions of Python. Running the tests is as simple as running this command in the makefile:

```
tox -e py311
```

This command will take care of downloading the client specifications and putting them in the correct place in the repository, and install all the dependencies you need.

However, there are some caveats to this method. There is no easy way to run a single test, and running the entire test suite can be slow.

### Manual setup

First, make sure you have pip or pip3 installed.

Then setup your viritual environment:

Linux & Mac:

```
python3 -m venv venv
source venv/bin/activate
```

Windows + cmd:

```
python -m venv venv
venv\Scripts\activate.bat
```

Powershell:

```
python -m venv venv
venv\Scripts\activate.bat
```

Once you've done your setup, run:
```
pip install -r requirements.txt
```

Run the get-spec script to download the client specifications tests:
```
./scripts/get-spec.sh
```

Now you can run the tests by running `pytest` in the root directory.

In order to run a single test, run the following command:

```
pytest testfile.py::function_name
# example: pytest tests/unit_tests/test_client.py::test_consistent_results
```

### Linting

In order to lint all the files you can run the following command:

```
make fmt
```

0 comments on commit f4679ab

Please sign in to comment.