8000 bpo-40275: reduce importing module nums by lazy import in libregrtest by shihai1991 · Pull Request #20207 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40275: reduce importing module nums by lazy import in libregrtest #20207

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert lazy import in basic test function
  • Loading branch information
shihai1991 committed Jun 17, 2020
commit 0bc2fbcf9dbaff5100cf46cc183d4dab3391b238
6 changes: 3 additions & 3 deletions Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import datetime
import faulthandler
import locale
import os
import platform
import random
import re
import sys
import sysconfig
import tempfile
import time
import unittest
from test.libregrtest.cmdline import _parse_args
Expand Down Expand Up @@ -196,7 +199,6 @@ def parse_args(self, kwargs):
self.ns = ns

def find_tests(self, tests):
import random
self.tests = tests

if self.ns.single:
Expand Down Expand Up @@ -562,7 +564,6 @@ def save_xml_result(self):
f.write(s)

def set_temp_dir(self):
import tempfile
if self.ns.tempdir:
self.tmp_dir = self.ns.tempdir

Expand Down Expand Up @@ -612,7 +613,6 @@ def cleanup(self):
support.unlink(name)

def main(self, tests=None, **kwargs):
import faulthandler
self.parse_args(kwargs)

self.set_temp_dir()
Expand Down
12 changes: 6 additions & 6 deletions Lib/test/libregrtest/setup.py
72E7
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import atexit
import faulthandler
import os
import signal
import sys
import unittest
from test import support
try:
import gc
except ImportError:
gc = None

from test.libregrtest.utils import setup_unraisable_hook


def setup_tests(ns):
import faulthandler
try:
import gc
except ImportError:
gc = None

try:
stderr_fd = sys.__stderr__.fileno()
except (ValueError, AttributeError):
Expand Down
0