mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-01 03:43:46 +08:00
Pytest: fix local params overriden (#30312)
* fix local params being overriden * just reset prefix after completion old-commit-hash: 412f4cbc1a82fe585d2beb5c84032c685f22e5ec
This commit is contained in:
@@ -14,6 +14,7 @@ class OpenpilotPrefix:
|
||||
self.clean_dirs_on_exit = clean_dirs_on_exit
|
||||
|
||||
def __enter__(self):
|
||||
self.original_prefix = os.environ.get('OPENPILOT_PREFIX', None)
|
||||
os.environ['OPENPILOT_PREFIX'] = self.prefix
|
||||
try:
|
||||
os.mkdir(self.msgq_path)
|
||||
@@ -28,6 +29,8 @@ class OpenpilotPrefix:
|
||||
self.clean_dirs()
|
||||
try:
|
||||
del os.environ['OPENPILOT_PREFIX']
|
||||
if self.original_prefix is not None:
|
||||
os.environ['OPENPILOT_PREFIX'] = self.original_prefix
|
||||
except KeyError:
|
||||
pass
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user