-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Xavier Dupre <[email protected]>
- Loading branch information
Showing
1 changed file
with
4 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,8 +156,9 @@ def run_function(obj, *inputs): | |
def extract_functions(name: str, content: str, test_folder: pathlib.Path): | ||
if not test_folder.exists(): | ||
test_folder.mkdir(exist_ok=True, parents=True) | ||
init = test_folder / "__init__.py" | ||
init.touch(exist_ok=True) | ||
init = str(test_folder / "__init__.py") | ||
with open(init, "w") as f: | ||
Check warning Code scanning / lintrunner PYLINT/W1514 Warning
Using open without explicitly specifying an encoding (unspecified-encoding)
See unspecified-encoding. To disable, use # pylint: disable=unspecified-encoding |
||
f.write("\n") | ||
filename = str(test_folder / f"{name}.py") | ||
with open(filename, "w", encoding="utf-8") as f: | ||
f.write(content + "\n") | ||
|
@@ -169,7 +170,7 @@ def extract_functions(name: str, content: str, test_folder: pathlib.Path): | |
mod = importlib.import_module(import_name) | ||
except (SyntaxError, ImportError) as e: | ||
try: | ||
import tests | ||
import tests # pylint: disable=import-outside-toplevel | ||
|
||
test_file = tests.__file__ | ||
except ImportError: | ||
|