python 2.4 (rhel 5) does not support 'with...as' syntax

resolves from a73c90cb...

    Using Python 2.4
    Using nose 0.1
    Running tito tests against: /home/sandbox/src
    EEEE.Warning: spacewalk.releng.* namespace in tito.props is obsolete. Use tito.* instead.
    Warning: spacewalk.releng.* namespace in tito.props is obsolete. Use tito.* instead.
    ..............................F...........
    ======================================================================
    ERROR: Failure: SyntaxError (invalid syntax (fixture.py, line 159))
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/nose/loader.py", line 381, in loadTestsFromName
        module = self.importer.importFromPath(
      File "/usr/lib/python2.4/site-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.4/site-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/home/sandbox/test/functional/fetch_tests.py", line 27, in ?
        from fixture import TitoGitTestFixture, tito
      File "/home/sandbox/test/functional/fixture.py", line 159
        with open(os.path.join(full_pkg_dir, 'tito.props'), 'w') \
                ^
    SyntaxError: invalid syntax
This commit is contained in:
Paul Morgan 2014-02-27 20:27:08 +00:00
parent 25c6f7f1e0
commit 9f2c259c85

View file

@ -156,9 +156,9 @@ class TitoGitTestFixture(unittest.TestCase):
shutil.copyfile(spec, os.path.join(full_pkg_dir, os.path.basename(spec)))
# Write the config object we were given out to the project repo:
with open(os.path.join(full_pkg_dir, 'tito.props'), 'w') \
as configfile:
config.write(configfile)
configfile = open(os.path.join(full_pkg_dir, 'tito.props'), 'w')
config.write(configfile)
configfile.close()
def create_project(self, pkg_name, pkg_dir=''):
"""