test : optimized import statements

This commit is contained in:
alalazo 2016-03-03 09:17:49 +01:00
parent 21cd05aad5
commit 717bcb8624
31 changed files with 62 additions and 129 deletions

View File

@ -22,8 +22,6 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
import spack
from spack.spec import Spec, CompilerSpec
from spack.test.mock_packages_test import *

View File

@ -22,13 +22,13 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
import shutil
import os
import shutil
from tempfile import mkdtemp
from ordereddict_backport import OrderedDict
import spack
import spack.config
from ordereddict_backport import OrderedDict
from spack.test.mock_packages_test import *
# Some sample compiler config data

View File

@ -23,20 +23,15 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
import unittest
import shutil
import tempfile
import unittest
from llnl.util.filesystem import *
from spack.cmd.create import ConfigureGuesser
from spack.stage import Stage
from spack.fetch_strategy import URLFetchStrategy
from spack.directory_layout import YamlDirectoryLayout
from spack.util.executable import which
from spack.test.mock_packages_test import *
from spack.test.mock_repo import MockArchive
from spack.util.executable import which
class InstallTest(unittest.TestCase):

View File

@ -26,19 +26,18 @@
These tests check the database is functioning properly,
both in memory and in its file
"""
import tempfile
import shutil
import multiprocessing
from llnl.util.lock import *
from llnl.util.filesystem import join_path
import shutil
import tempfile
import spack
from llnl.util.filesystem import join_path
from llnl.util.lock import *
from llnl.util.tty.colify import colify
from spack.database import Database
from spack.directory_layout import YamlDirectoryLayout
from spack.test.mock_packages_test import *
from llnl.util.tty.colify import colify
def _print_ref_counts():
"""Print out all ref counts for the graph used here, for debugging"""

View File

@ -25,20 +25,17 @@
"""\
This test verifies that the Spack directory layout works properly.
"""
import unittest
import tempfile
import shutil
import os
from llnl.util.filesystem import *
import shutil
import tempfile
import spack
from spack.spec import Spec
from spack.repository import RepoPath
from llnl.util.filesystem import *
from spack.directory_layout import YamlDirectoryLayout
from spack.repository import RepoPath
from spack.spec import Spec
from spack.test.mock_packages_test import *
# number of packages to test (to reduce test time)
max_packages = 10

View File

@ -23,19 +23,12 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
import unittest
import shutil
import tempfile
from llnl.util.filesystem import *
import spack
from spack.version import ver
from spack.stage import Stage
from spack.util.executable import which
from llnl.util.filesystem import *
from spack.test.mock_packages_test import *
from spack.test.mock_repo import MockGitRepo
from spack.version import ver
class GitFetchTest(MockPackagesTest):

View File

@ -23,16 +23,12 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
import unittest
from llnl.util.filesystem import *
import spack
from spack.version import ver
from spack.stage import Stage
from spack.util.executable import which
from spack.test.mock_packages_test import *
from spack.test.mock_repo import MockHgRepo
from llnl.util.filesystem import *
from spack.test.mock_packages_test import *
class HgFetchTest(MockPackagesTest):

View File

@ -22,18 +22,13 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
import unittest
import shutil
import tempfile
from llnl.util.filesystem import *
import spack
from spack.stage import Stage
from spack.fetch_strategy import URLFetchStrategy, FetchStrategyComposite
from llnl.util.filesystem import *
from spack.directory_layout import YamlDirectoryLayout
from spack.util.executable import which
from spack.fetch_strategy import URLFetchStrategy, FetchStrategyComposite
from spack.test.mock_packages_test import *
from spack.test.mock_repo import MockArchive

View File

@ -24,8 +24,6 @@
##############################################################################
import os
import unittest
import shutil
import tempfile
from llnl.util.filesystem import *
from llnl.util.link_tree import LinkTree
@ -38,8 +36,7 @@ class LinkTreeTest(unittest.TestCase):
def setUp(self):
self.stage = Stage('link-tree-test')
# FIXME : possibly this test needs to be refactored to avoid the explicit call to __enter__ and __exit__
self.stage.__enter__()
self.stage.create()
with working_dir(self.stage.path):
touchp('source/1')
@ -54,7 +51,7 @@ def setUp(self):
self.link_tree = LinkTree(source_path)
def tearDown(self):
self.stage.__exit__(None, None, None)
self.stage.destroy()
def check_file_link(self, filename):

View File

@ -25,15 +25,13 @@
"""
These tests ensure that our lock works correctly.
"""
import unittest
import os
import tempfile
import shutil
import tempfile
import unittest
from multiprocessing import Process
from llnl.util.lock import *
from llnl.util.filesystem import join_path, touch
from llnl.util.lock import *
from spack.util.multiproc import Barrier
# This is the longest a failed test will take, as the barriers will

View File

@ -28,13 +28,13 @@
This just tests whether the right args are getting passed to make.
"""
import os
import unittest
import tempfile
import shutil
import tempfile
import unittest
from llnl.util.filesystem import *
from spack.util.environment import path_put_first
from spack.build_environment import MakeExecutable
from spack.util.environment import path_put_first
class MakeExecutableTest(unittest.TestCase):

View File

@ -23,11 +23,10 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
from filecmp import dircmp
import spack
import spack.mirror
from spack.util.compression import decompressor_for
from filecmp import dircmp
from spack.test.mock_packages_test import *
from spack.test.mock_repo import *

View File

@ -22,17 +22,15 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import sys
import os
import shutil
import unittest
import tempfile
from ordereddict_backport import OrderedDict
from llnl.util.filesystem import mkdirp
import unittest
import spack
import spack.config
from llnl.util.filesystem import mkdirp
from ordereddict_backport import OrderedDict
from spack.repository import RepoPath
from spack.spec import Spec

View File

@ -26,13 +26,9 @@
import shutil
from llnl.util.filesystem import *
import spack
from spack.version import ver
from spack.stage import Stage
from spack.util.executable import which
#
# VCS Systems used by mock repo code.
#

View File

@ -25,14 +25,11 @@
"""
Test for multi_method dispatch.
"""
import unittest
import spack
from spack.multimethod import *
from spack.version import *
from spack.spec import Spec
from spack.multimethod import when
from spack.test.mock_packages_test import *
from spack.version import *
class MultiMethodTest(MockPackagesTest):

View File

@ -23,6 +23,7 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
from spack.util.naming import NamespaceTrie

View File

@ -22,10 +22,8 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
import spack
from spack.spec import Spec, CompilerSpec
from spack.spec import Spec
from spack.test.mock_packages_test import *
class ConcretizeTest(MockPackagesTest):

View File

@ -22,14 +22,12 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
from llnl.util.filesystem import join_path
import spack
from llnl.util.filesystem import join_path
from spack.repository import Repo
from spack.util.naming import mod_to_class
from spack.test.mock_packages_test import *
from spack.util.naming import mod_to_class
class PackagesTest(MockPackagesTest):
@ -77,30 +75,20 @@ def test_package_class_names(self):
#
def test_import_package(self):
import spack.pkg.builtin.mock.mpich
pass
def test_import_package_as(self):
import spack.pkg.builtin.mock.mpich as mp
pass
def test_import_class_from_package(self):
from spack.pkg.builtin.mock.mpich import Mpich
pass
def test_import_module_from_package(self):
from spack.pkg.builtin.mock import mpich
pass
def test_import_namespace_container_modules(self):
import spack.pkg
import spack.pkg as p
from spack import pkg
import spack.pkg.builtin
import spack.pkg.builtin as b
from spack.pkg import builtin
import spack.pkg.builtin.mock
import spack.pkg.builtin.mock as m
from spack.pkg.builtin import mock
pass

View File

@ -28,12 +28,11 @@
Spack was originally 2.7, but enough systems in 2014 are still using
2.6 on their frontend nodes that we need 2.6 to get adopted.
"""
import unittest
import os
import re
import unittest
import llnl.util.tty as tty
import pyqver2
import spack

View File

@ -31,8 +31,6 @@
import spack
import spack.package
from llnl.util.lang import list_modules
from spack.spec import Spec
from spack.test.mock_packages_test import *

View File

@ -22,7 +22,6 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
from spack.spec import *
from spack.test.mock_packages_test import *

View File

@ -23,9 +23,10 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
import spack.spec
from spack.spec import *
from spack.parse import Token
from spack.spec import *
# Sample output for a complex lexing.
complex_lex = [Token(ID, 'mvapich_foo'),

View File

@ -25,15 +25,13 @@
"""\
Test that the Stage class works correctly.
"""
import unittest
import shutil
import os
import getpass
import shutil
import unittest
from contextlib import *
from llnl.util.filesystem import *
import spack
from llnl.util.filesystem import *
from spack.stage import Stage
from spack.util.executable import which

View File

@ -24,18 +24,12 @@
##############################################################################
import os
import re
import unittest
import shutil
import tempfile
from llnl.util.filesystem import *
import spack
from spack.version import ver
from spack.stage import Stage
from spack.util.executable import which
from spack.test.mock_packages_test import *
from spack.test.mock_repo import svn, MockSvnRepo
from spack.version import ver
from spack.test.mock_packages_test import *
from llnl.util.filesystem import *
class SvnFetchTest(MockPackagesTest):

View File

@ -22,10 +22,10 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from nose.plugins import Plugin
import os
from nose.plugins import Plugin
class Tally(Plugin):
name = 'tally'

View File

@ -22,10 +22,11 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
import itertools
import unittest
import spack
test_install = __import__("spack.cmd.test-install",
fromlist=["BuildId", "create_test_output", "TestResult"])

View File

@ -25,10 +25,7 @@
"""\
Tests ability of spack to extrapolate URL versions from existing versions.
"""
import spack
import spack.url as url
from spack.spec import Spec
from spack.version import ver
from spack.test.mock_packages_test import *

View File

@ -27,8 +27,8 @@
detection in Homebrew.
"""
import unittest
import spack.url as url
from pprint import pprint
class UrlParseTest(unittest.TestCase):

View File

@ -27,7 +27,6 @@
"""
import unittest
import spack
import spack.url as url

View File

@ -28,6 +28,7 @@
where it makes sense.
"""
import unittest
from spack.version import *

View File

@ -26,6 +26,7 @@
Test Spack's custom YAML format.
"""
import unittest
import spack.util.spack_yaml as syaml
test_file = """\