Skip to content

Commit

Permalink
Removing flaky by running the test only on RGB (#1134)
Browse files Browse the repository at this point in the history
* Removing flaky by running the test only on RGB
Testing RGB gets 1.0 values too often which makes the test fail regularly.
The same functionality is achieved by running only RGB in this test.

* wrong condition fix

---------

Co-authored-by: vincentpierre <vincentpierre@users.noreply.github.com>
  • Loading branch information
vincentpierre and vincentpierre authored Feb 17, 2023
1 parent 8586ae9 commit cfc0fee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ jobs:
conda create -y -n habitat python=3.7
. activate habitat
pip install -U pip
conda install -q -y -c conda-forge ninja ccache numpy
pip install pytest-sugar>=0.9.6 mock cython pygame flaky pytest pytest-mock pytest-cov psutil
fi
Expand Down
12 changes: 8 additions & 4 deletions test/test_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ def test_imagegoal_sensor():
)


@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_get_observations_at():
config = get_test_config()
if not os.path.exists(config.habitat.simulator.scene):
Expand Down Expand Up @@ -393,9 +392,14 @@ def test_get_observations_at():
new_obs = env.step(sample_non_stop_action(env.action_space))
for key, val in new_obs.items():
agent_state = env.sim.get_agent_state()
if not (
np.allclose(agent_state.position, start_state.position)
and np.allclose(agent_state.rotation, start_state.rotation)
if (
not (
np.allclose(agent_state.position, start_state.position)
and np.allclose(
agent_state.rotation, start_state.rotation
)
)
and "rgb" in key
):
assert not np.allclose(val, obs[key])
obs_at_point = env.sim.get_observations_at(
Expand Down

0 comments on commit cfc0fee

Please sign in to comment.