Python tests: skip importing weirdly-named modules (#27151)
* Python tests: allow importing weirdly-named modules e.g. with dashes in name * SIP tests: allow importing weirdly-named modules * Skip modules with invalid names * Changes from review * Update from review * Update from review * Cleanup
This commit is contained in:
parent
db504db9aa
commit
f164bae4a3
@ -4,6 +4,7 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
import llnl.util.tty as tty
|
||||
@ -144,6 +145,8 @@ def import_modules(self):
|
||||
modules.append(path.replace(root + os.sep, '', 1).replace(
|
||||
'.py', '').replace('/', '.'))
|
||||
|
||||
modules = [mod for mod in modules if re.match('[a-zA-Z0-9._]+$', mod)]
|
||||
|
||||
tty.debug('Detected the following modules: {0}'.format(modules))
|
||||
|
||||
return modules
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import find, join_path, working_dir
|
||||
@ -81,6 +82,8 @@ def import_modules(self):
|
||||
modules.append(path.replace(root + os.sep, '', 1).replace(
|
||||
'.py', '').replace('/', '.'))
|
||||
|
||||
modules = [mod for mod in modules if re.match('[a-zA-Z0-9._]+$', mod)]
|
||||
|
||||
tty.debug('Detected the following modules: {0}'.format(modules))
|
||||
|
||||
return modules
|
||||
|
Loading…
Reference in New Issue
Block a user