Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use a single temp dir for the test class #462

Merged
merged 1 commit into from
Jul 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions ros2bag/test/test_record_qos_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ def launch_bag_command(self, arguments, **kwargs):
) as pkg_command:
yield pkg_command
cls.launch_bag_command = launch_bag_command
cls.tmpdir = tempfile.TemporaryDirectory()

@classmethod
def tearDownClass(cls):
cls.tmpdir.cleanup()

def test_qos_simple(self):
profile_path = PROFILE_PATH / 'qos_profile.yaml'
with tempfile.TemporaryDirectory() as tmpdirname:
output_path = Path(tmpdirname) / 'ros2bag_test_basic'
output_path = Path(self.tmpdir.name) / 'ros2bag_test_basic'
arguments = ['record', '-a', '--qos-profile-overrides-path', profile_path.as_posix(),
'--output', output_path.as_posix()]
with self.launch_bag_command(arguments=arguments) as bag_command:
Expand All @@ -76,8 +80,7 @@ def test_qos_simple(self):

def test_incomplete_qos_profile(self):
profile_path = PROFILE_PATH / 'incomplete_qos_profile.yaml'
with tempfile.TemporaryDirectory() as tmpdirname:
output_path = Path(tmpdirname) / 'ros2bag_test_incomplete'
output_path = Path(self.tmpdir.name) / 'ros2bag_test_incomplete'
arguments = ['record', '-a', '--qos-profile-overrides-path', profile_path.as_posix(),
'--output', output_path.as_posix()]
with self.launch_bag_command(arguments=arguments) as bag_command:
Expand All @@ -88,8 +91,7 @@ def test_incomplete_qos_profile(self):

def test_incomplete_qos_duration(self):
profile_path = PROFILE_PATH / 'incomplete_qos_duration.yaml'
with tempfile.TemporaryDirectory() as tmpdirname:
output_path = Path(tmpdirname) / 'ros2bag_test_incomplete_duration'
output_path = Path(self.tmpdir.name) / 'ros2bag_test_incomplete_duration'
arguments = ['record', '-a', '--qos-profile-overrides-path', profile_path.as_posix(),
'--output', output_path.as_posix()]
with self.launch_bag_command(arguments=arguments) as bag_command:
Expand All @@ -101,8 +103,7 @@ def test_incomplete_qos_duration(self):

def test_nonexistent_qos_profile(self):
profile_path = PROFILE_PATH / 'foobar.yaml'
with tempfile.TemporaryDirectory() as tmpdirname:
output_path = Path(tmpdirname) / 'ros2bag_test_incomplete'
output_path = Path(self.tmpdir.name) / 'ros2bag_test_nonexistent'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I changed the name of the subdirectory which wasn't unique and looked like a copy-n-paste mistake.

arguments = ['record', '-a', '--qos-profile-overrides-path', profile_path.as_posix(),
'--output', output_path.as_posix()]
with self.launch_bag_command(arguments=arguments) as bag_command:
Expand Down