Skip to content

Commit

Permalink
Fix potential bug in test_rosdep_sources_list.py (#952)
Browse files Browse the repository at this point in the history
When running pytest from anywhere else than the project root directory,
test_rosdep_sources_list.py would fail because there was 2 hardcoded
path that depended on where the test was run from.

This commit fixes this by using a relative path from the aforementioned
file, which is the same logic used in other tests.
  • Loading branch information
SubaruArai authored Apr 16, 2024
1 parent 3481576 commit ac4fc15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/test_rosdep_sources_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,9 @@ def test_unpickle_same_results():
import cPickle as pickle
except ImportError:
import pickle
with open(os.path.join('test', 'fixtures', 'python2cache.pickle'), 'rb') as py2_cache:
fixture_dir = os.path.join(os.path.dirname(__file__), 'fixtures')
with open(os.path.join(fixture_dir, 'python2cache.pickle'), 'rb') as py2_cache:
py2_result = pickle.loads(py2_cache.read())
with open(os.path.join('test', 'fixtures', 'python3cache.pickle'), 'rb') as py3_cache:
with open(os.path.join(fixture_dir, 'python3cache.pickle'), 'rb') as py3_cache:
py3_result = pickle.loads(py3_cache.read())
assert py2_result == py3_result

0 comments on commit ac4fc15

Please sign in to comment.