Python test.support.import_fresh_module() Examples
The following are 14
code examples of test.support.import_fresh_module().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
test.support
, or try the search function
.
Example #1
Source File: test_test_support.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_import_fresh_module(self): support.import_fresh_module("ftplib")
Example #2
Source File: test_support.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_import_fresh_module(self): support.import_fresh_module("ftplib")
Example #3
Source File: test_bz2.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def testWithoutThreading(self): module = support.import_fresh_module("bz2", blocked=("threading",)) with module.BZ2File(self.filename, "wb") as f: f.write(b"abc") with module.BZ2File(self.filename, "rb") as f: self.assertEqual(f.read(), b"abc")
Example #4
Source File: util.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def import_importlib(module_name): """Import a module from importlib both w/ and w/o _frozen_importlib.""" fresh = ('importlib',) if '.' in module_name else () frozen = support.import_fresh_module(module_name) source = support.import_fresh_module(module_name, fresh=fresh, blocked=('_frozen_importlib', '_frozen_importlib_external')) return {'Frozen': frozen, 'Source': source}
Example #5
Source File: test_support.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_import_fresh_module(self): support.import_fresh_module("ftplib")
Example #6
Source File: test_bz2.py From ironpython3 with Apache License 2.0 | 5 votes |
def testWithoutThreading(self): module = support.import_fresh_module("bz2", blocked=("threading",)) with module.BZ2File(self.filename, "wb") as f: f.write(b"abc") with module.BZ2File(self.filename, "rb") as f: self.assertEqual(f.read(), b"abc")
Example #7
Source File: util.py From ironpython3 with Apache License 2.0 | 5 votes |
def import_importlib(module_name): """Import a module from importlib both w/ and w/o _frozen_importlib.""" fresh = ('importlib',) if '.' in module_name else () frozen = support.import_fresh_module(module_name) source = support.import_fresh_module(module_name, fresh=fresh, blocked=('_frozen_importlib',)) return frozen, source
Example #8
Source File: test_support.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_import_fresh_module(self): support.import_fresh_module("ftplib")
Example #9
Source File: test_bz2.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def testWithoutThreading(self): module = support.import_fresh_module("bz2", blocked=("threading",)) with module.BZ2File(self.filename, "wb") as f: f.write(b"abc") with module.BZ2File(self.filename, "rb") as f: self.assertEqual(f.read(), b"abc")
Example #10
Source File: util.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def import_importlib(module_name): """Import a module from importlib both w/ and w/o _frozen_importlib.""" fresh = ('importlib',) if '.' in module_name else () frozen = support.import_fresh_module(module_name) source = support.import_fresh_module(module_name, fresh=fresh, blocked=('_frozen_importlib', '_frozen_importlib_external')) return {'Frozen': frozen, 'Source': source}
Example #11
Source File: test_support.py From android_universal with MIT License | 5 votes |
def test_import_fresh_module(self): support.import_fresh_module("ftplib")
Example #12
Source File: test_xml_etree.py From Fluid-Designer with GNU General Public License v3.0 | 4 votes |
def test_main(module=None): # When invoked without a module, runs the Python ET tests by loading pyET. # Otherwise, uses the given module as the ET. global pyET pyET = import_fresh_module('xml.etree.ElementTree', blocked=['_elementtree']) if module is None: module = pyET global ET ET = module test_classes = [ ModuleTest, ElementSlicingTest, BasicElementTest, BadElementTest, BadElementPathTest, ElementTreeTest, IOTest, ParseErrorTest, XIncludeTest, ElementTreeTypeTest, ElementFindTest, ElementIterTest, TreeBuilderTest, XMLParserTest, XMLPullParserTest, BugsTest, ] # These tests will only run for the pure-Python version that doesn't import # _elementtree. We can't use skipUnless here, because pyET is filled in only # after the module is loaded. if pyET is not ET: test_classes.extend([ NoAcceleratorTest, ]) try: # XXX the C module should give the same warnings as the Python module with CleanContext(quiet=(pyET is not ET)): support.run_unittest(*test_classes) finally: # don't interfere with subsequent tests ET = pyET = None
Example #13
Source File: test_xml_etree.py From ironpython3 with Apache License 2.0 | 4 votes |
def test_main(module=None): # When invoked without a module, runs the Python ET tests by loading pyET. # Otherwise, uses the given module as the ET. global pyET pyET = import_fresh_module('xml.etree.ElementTree', blocked=['_elementtree']) if module is None: module = pyET global ET ET = module test_classes = [ ModuleTest, ElementSlicingTest, BasicElementTest, BadElementTest, BadElementPathTest, ElementTreeTest, IOTest, ParseErrorTest, XIncludeTest, ElementTreeTypeTest, ElementFindTest, ElementIterTest, TreeBuilderTest, XMLParserTest, XMLPullParserTest, BugsTest, ] # These tests will only run for the pure-Python version that doesn't import # _elementtree. We can't use skipUnless here, because pyET is filled in only # after the module is loaded. if pyET is not ET: test_classes.extend([ NoAcceleratorTest, ]) try: # XXX the C module should give the same warnings as the Python module with CleanContext(quiet=(pyET is not ET)): support.run_unittest(*test_classes) finally: # don't interfere with subsequent tests ET = pyET = None
Example #14
Source File: test_xml_etree.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 4 votes |
def test_main(module=None): # When invoked without a module, runs the Python ET tests by loading pyET. # Otherwise, uses the given module as the ET. global pyET pyET = import_fresh_module('xml.etree.ElementTree', blocked=['_elementtree']) if module is None: module = pyET global ET ET = module test_classes = [ ModuleTest, ElementSlicingTest, BasicElementTest, BadElementTest, BadElementPathTest, ElementTreeTest, IOTest, ParseErrorTest, XIncludeTest, ElementTreeTypeTest, ElementFindTest, ElementIterTest, TreeBuilderTest, XMLParserTest, XMLPullParserTest, BugsTest, ] # These tests will only run for the pure-Python version that doesn't import # _elementtree. We can't use skipUnless here, because pyET is filled in only # after the module is loaded. if pyET is not ET: test_classes.extend([ NoAcceleratorTest, ]) try: # XXX the C module should give the same warnings as the Python module with CleanContext(quiet=(pyET is not ET)): support.run_unittest(*test_classes) finally: # don't interfere with subsequent tests ET = pyET = None