Repository navigation
Conversation
| """ Tests RewriteArrayExprs with external (user defined) types, | ||
| see #5157""" | ||
|
|
||
| source_lines = """ |
There was a problem hiding this comment.
would suggest to use textwrap.dedent for better code alignment here: https://docs.python.org/3/library/textwrap.html#textwrap.dedent
There was a problem hiding this comment.
done
thanks
|
@stuartarchibald |
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@Alexander-Makaryev I've restarted the build, and am working on a fix, it's not this PR at fault. Once a fix for it makes it into mainline the CI builders will pick it up and it shouldn't happen again (at least for this particular issue). |
stuartarchibald
left a comment
There was a problem hiding this comment.
Thanks for the patch and for fixing this issue, just one minor comment to resolve else looks good.
| # copied from test_types | ||
| @contextlib.contextmanager | ||
| def create_temp_module(self, source_lines=None, **jit_options): | ||
| # Use try/finally so cleanup happens even when an exception is raised | ||
| try: | ||
| if source_lines is None: | ||
| source_lines = self.source_lines | ||
| tempdir = temp_directory('test_extension_type') | ||
| # Generate random module name | ||
| temp_module_name = 'test_extension_type_{}'.format( | ||
| str(uuid.uuid4()).replace('-', '_')) | ||
| temp_module_path = os.path.join(tempdir, temp_module_name + '.py') | ||
|
|
||
| with open(temp_module_path, 'w') as f: | ||
| lines = source_lines.format(jit_options=jit_options) | ||
| f.write(lines) | ||
| # Add test_module to sys.path so it can be imported | ||
| sys.path.insert(0, tempdir) | ||
| test_module = importlib.import_module(temp_module_name) | ||
| yield test_module | ||
| finally: | ||
| sys.modules.pop(temp_module_name, None) | ||
| sys.path.remove(tempdir) | ||
| shutil.rmtree(tempdir) | ||
|
|
There was a problem hiding this comment.
It'd be nice to refactor this into numba.tests.support, but perhaps not for this PR.
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
stuartarchibald
left a comment
There was a problem hiding this comment.
Thanks for the fix @Alexander-Makaryev, looks good.
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Fixes #5157
Please look at issue for more details.
The implementation is based on comment from @stuartarchibald :
#5157 (comment)