def test_has_tempdir(self): fixture = PythonPackage('foo', []) fixture.setUp() try: self.assertTrue(os.path.isdir(fixture.base)) finally: fixture.cleanUp()
def test_no__init__(self): fixture = PythonPackage('foo', [('bar.py', _b('woo'))], init=False) fixture.setUp() try: self.assertFalse(os.path.exists(os.path.join(fixture.base, 'foo', '__init__.py'))) finally: fixture.cleanUp()
def test_writes_package(self): fixture = PythonPackage('foo', [('bar.py', _b('woo'))]) fixture.setUp() try: self.assertEqual('', open(os.path.join(fixture.base, 'foo', '__init__.py')).read()) self.assertEqual('woo', open(os.path.join(fixture.base, 'foo', 'bar.py')).read()) finally: fixture.cleanUp()
def test_no__init__(self): fixture = PythonPackage('foo', [('bar.py', _b('woo'))], init=False) fixture.setUp() try: self.assertFalse( os.path.exists(os.path.join(fixture.base, 'foo', '__init__.py'))) finally: fixture.cleanUp()
def test_writes_package(self): fixture = PythonPackage('foo', [('bar.py', _b('woo'))]) fixture.setUp() try: self.assertEqual( '', open(os.path.join(fixture.base, 'foo', '__init__.py')).read()) self.assertEqual( 'woo', open(os.path.join(fixture.base, 'foo', 'bar.py')).read()) finally: fixture.cleanUp()