PathmindAI / nativerl

Train reinforcement learning agents using AnyLogic or Python-based simulations
Apache License 2.0
19 stars 4 forks source link

Add auto-tests and code linting checks for PR #439

Closed slinlee closed 3 years ago

slinlee commented 3 years ago

For all PR to nativeRL, this will check basic code syntax, linting and run auto-tests for pynativerl.

To run code syntax formatting locally:

> pip install -r nativerl/python/requirements-dev.txt
> pre-commit run --all-files

When you create a commit it will automatically lint and format your code.

To run python tests locally:

> pip install -r nativerl/python/requirements-dev.txt
> cd nativerl/python/
> USE_PY_NATIVERL=True pytest

I set up the policy server tests to query a policy trained for the AnyLogic version of mouse and cheese. That required different observation names.

Requires https://github.com/PathmindAI/pathmind-api/pull/2 for the test_policy_serving to pass.

slinlee commented 3 years ago

@maxpumperla this is more or less ready for review. Obviously the bulk of it is applying the code formatting and it's mostly whitespace fixes since you applied Black to the python files already in your PR. Thanks.

I'd like a second set of eyes on the changes in the other commits related to getting tests to work. I also split out a few small things to separate issues too.

You can see the results of the autotests here: https://github.com/SkymindIO/nativerl/pull/439/checks

slinlee commented 3 years ago

Sorry, I marked those as resolved even though I usually prefer the original commenter to mark it resolved if needed.

maxpumperla commented 3 years ago

Perfectly fine with me! Thanks for this. 👍