Skip to content

Commit

Permalink
Merge pull request #76 from jerryz123/gym_tests
Browse files Browse the repository at this point in the history
Added gym enviroment test
  • Loading branch information
jerryz123 committed Jul 10, 2018
2 parents 3f302e2 + be065ec commit ccf22d8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ temp/
test_data/
*.model
*.pickle
docs/build/*
.coverage

.coveralls.yml
21 changes: 13 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ python:

# command to install dependencies
install:
- pip install -e .
- pip install -e .
- pip install -e gym_fluids
- pip install sphinx==1.6.5 recommonmark sphinx_rtd_theme pyyaml coveralls

env:
Expand All @@ -14,22 +15,26 @@ env:

# command to run tests
script:
- cd docs && make html
- make -C docs html
- python -m fluids --time 100 -v 0 -o birdseye
- python -m fluids --time 100 -v 0 -o grid
- python -m fluids --time 100 -v 0 -o none

- xvfb-run --server-args="-screen 0 1920x1080x16" python -m fluids --time 100 -v 99 -o birdseye
- xvfb-run --server-args="-screen 0 1920x1080x16" python -m fluids --time 100 -v 99 -o grid
- xvfb-run --server-args="-screen 0 1920x1080x16" python -m fluids --time 100 -v 99 -o none
- xvfb-run -a --server-args="-screen 0 1920x1080x16" python -m fluids --time 100 -v 99 -o birdseye
- xvfb-run -a --server-args="-screen 0 1920x1080x16" python -m fluids --time 100 -v 99 -o grid
- xvfb-run -a --server-args="-screen 0 1920x1080x16" python -m fluids --time 100 -v 99 -o none

- xvfb-run -a --server-args="-screen 0 1920x1080x16" python tests/test_gym.py

- coverage run -a --source fluids -m fluids --time 100 -v 0 -o birdseye
- coverage run -a --source fluids -m fluids --time 100 -v 0 -o grid
- coverage run -a --source fluids -m fluids --time 100 -v 0 -o none

- xvfb-run --server-args="-screen 0 1920x1080x16" coverage run -a --source fluids -m fluids --time 100 -v 99 -o birdseye
- xvfb-run --server-args="-screen 0 1920x1080x16" coverage run -a --source fluids -m fluids --time 100 -v 99 -o grid
- xvfb-run --server-args="-screen 0 1920x1080x16" coverage run -a --source fluids -m fluids --time 100 -v 99 -o none
- xvfb-run -a --server-args="-screen 0 1920x1080x16" coverage run -a --source fluids -m fluids --time 100 -v 99 -o birdseye
- xvfb-run -a --server-args="-screen 0 1920x1080x16" coverage run -a --source fluids -m fluids --time 100 -v 99 -o grid
- xvfb-run -a --server-args="-screen 0 1920x1080x16" coverage run -a --source fluids -m fluids --time 100 -v 99 -o none

- xvfb-run -a --server-args="-screen 0 1920x1080x16" coverage run -a --source fluids,gym_fluids tests/test_gym.py

after_success:
- coveralls
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ The FLUIDS Gym environments provide a familiar interface to the FLUIDS simulator
To install from source,
```
git submodule update --init --recursive
cd gym_fluids
pip3 install -e .
pip3 install -e gym_fluids
```
3 changes: 1 addition & 2 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ The FLUIDS Gym Environment is compatible with agents designed for OpenAI's Gym b
::
git submodule update --init --recursive
cd gym_fluids
pip3 install -e .
pip3 install -e gym_fluids
12 changes: 12 additions & 0 deletions tests/test_gym.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import gym
import gym_fluids

env = gym.make("fluids-v2")
env.reset()

for i in range(10):
obs, rew, done, _ = env.step([0, 0])
assert(obs.shape == (400, 400, 3))
assert(rew == 0)
env.render()

0 comments on commit ccf22d8

Please sign in to comment.