-
Notifications
You must be signed in to change notification settings - Fork 19
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
Improvements to import_file() and run_file() #70
Conversation
@jsiirola Given the nature of these changes, I think it's important to add a few tests to confirm that these changes capture the behavior that motivated the PR. |
@whart222: absolutely. Tests added. |
Was there a typo in the last test from this PR? It seems to be testing the wrong function.
… On Dec 13, 2019, at 11:28 AM, Bethany Nicholson ***@***.***> wrote:
Merged #70 into master.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@ghackebeil I'm not sure what you're referring to. Where do you think there's an error? |
def test_import_exception(self): | ||
orig_path = list(sys.path) | ||
with self.assertRaisesRegexp(RuntimeError, "raised during import"): | ||
pyutilib.misc.run_file( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be calling pyutilib.misc.import_file
instead of pytuilib.misc.run_file
? The test is on the TestImportFile
class.
Fixes: N/A
Summary/Motivation:
This improves the robustness of
import_file()
andrun_file()
so that thesys.path
is not left in an altered state in the event that the import raises an exception. This also switches to using tools fromsys.path
for performing path manipulations (instead of hard-coded/
and\
characters).Changes proposed in this PR:
sys.path
when imports raise exceptions/
and\
path separator characters.Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: