def start(): print "######## Auger testing start" import error import license import log import preferences import version_manager import versions test_subjects = [ error, log, preferences, version_manager, license, versions.v00001.install, versions.v00001.main, versions.v00001.process, versions.v00001.suspender, versions.v00001.utils, ] mock_subsitutes = { "genericpath": "os.path", "posixpath": "os.path", } global tester tester = auger.magic(test_subjects, mock_substitutes=mock_subsitutes) tester.__enter__() version_manager.main(done)
class Foo: # Declare a class with a method def bar(self, x): return 2 * x def test(): foo = Foo() # Create an instance of Foo print(foo.bar(32)) # Print 64 import auger with auger.magic([Foo]): test()
import auger from . import main, animal, pet from . import foo from . import properties from . import functions test_subjects = [animal, pet, foo.Foo, properties.Language, functions] mock_sustitutes = { "genericpath": "os.path", "genericpath": "os.path", } extra_imports = [ ('random', 'Random'), ] with auger.magic(test_subjects, mock_substitutes=mock_sustitutes, extra_imports=extra_imports): main.main() foo.main() properties.main() functions.main()
import auger from BitcoinComponent import BitcoinTransformer def main(): p = BitcoinTransformer() print(p) with auger.magic([BitcoinTransformer]): main()
import auger import main, animal, pet with auger.magic([animal, pet]): main.main()
import auger from sample import animal, pet def main(): clifford = pet.create_pet('Clifford', 'Dog', 12) print('This dog is %d years old.' % clifford.get_age()) print(clifford) with auger.magic([pet, animal]): main()
import auger import pet import animal def main(): p = pet.create_pet("Polly", "Parrot") print(p, p.get_name(), p.get_species()) if __name__ == "__main__": with auger.magic([pet.Pet]): main()