mirror of
https://github.com/beetbox/beets.git
synced 2025-12-09 10:05:35 +01:00
Ensure we go back to default path implementation
If an error is raised within the mock path context and catched upstream the rest of the tests will run with the mocked path and fail horribly.
This commit is contained in:
parent
1253cb695d
commit
c73ada92c8
1 changed files with 10 additions and 6 deletions
|
|
@ -257,14 +257,18 @@ class Bag(object):
|
|||
def platform_windows():
|
||||
import ntpath
|
||||
old_path = os.path
|
||||
os.path = ntpath
|
||||
yield
|
||||
os.path = old_path
|
||||
try:
|
||||
os.path = ntpath
|
||||
yield
|
||||
finally:
|
||||
os.path = old_path
|
||||
|
||||
@contextmanager
|
||||
def platform_posix():
|
||||
import posixpath
|
||||
old_path = os.path
|
||||
os.path = posixpath
|
||||
yield
|
||||
os.path = old_path
|
||||
try:
|
||||
os.path = posixpath
|
||||
yield
|
||||
finally:
|
||||
os.path = old_path
|
||||
|
|
|
|||
Loading…
Reference in a new issue