-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3064 from VesnaT/recent_path
[ENH] RecentFiles: Check for missing file in workflow dir
- Loading branch information
Showing
3 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
import unittest | ||
from tempfile import NamedTemporaryFile | ||
|
||
from Orange.widgets.utils.filedialogs import RecentPath | ||
|
||
|
||
class TestRecentPath(unittest.TestCase): | ||
def test_resolve(self): | ||
temp_file = NamedTemporaryFile(dir=os.getcwd(), delete=False) | ||
file_name = temp_file.name | ||
temp_file.close() | ||
base_name = os.path.basename(file_name) | ||
try: | ||
recent_path = RecentPath( | ||
os.path.join("temp/datasets", base_name), "", | ||
os.path.join("datasets", base_name) | ||
) | ||
search_paths = [("basedir", os.getcwd())] | ||
self.assertIsNotNone(recent_path.resolve(search_paths)) | ||
finally: | ||
os.remove(file_name) |