From a80fc5b6b05ced1e49b9502b5e401e7176799b56 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 11 Mar 2014 09:25:45 -0300 Subject: [PATCH] Use test util to write files. --- test/functional/fixture.py | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/test/functional/fixture.py b/test/functional/fixture.py index e779172..dfba03b 100644 --- a/test/functional/fixture.py +++ b/test/functional/fixture.py @@ -162,30 +162,20 @@ class TitoGitTestFixture(unittest.TestCase): # TODO: Test project needs work, doesn't work in some scenarios # like UpstreamBuilder: - filename = os.path.join(full_pkg_dir, "a.txt") - out_f = open(filename, 'w') - out_f.write("BLERG\n") - out_f.close() + self.write_file(os.path.join(full_pkg_dir, 'a.txt'), "BLERG\n") # Write the test spec file: - filename = os.path.join(full_pkg_dir, "%s.spec" % pkg_name) - out_f = open(filename, 'w') - out_f.write("Name: %s" % pkg_name) - out_f.write(TEST_SPEC) - out_f.close() + self.write_file(os.path.join(full_pkg_dir, "%s.spec" % pkg_name), + "Name: %s\n%s" % (pkg_name, TEST_SPEC)) # Write test setup.py: - filename = os.path.join(full_pkg_dir, "setup.py") - out_f = open(filename, 'w') - out_f.write(TEST_SETUP_PY % (pkg_name, pkg_name)) - out_f.close() + self.write_file(os.path.join(full_pkg_dir, "setup.py"), + TEST_SETUP_PY % (pkg_name, pkg_name)) # Write test source: run_command('mkdir -p %s' % os.path.join(full_pkg_dir, "src")) - filename = os.path.join(full_pkg_dir, "src", "module.py") - out_f = open(filename, 'w') - out_f.write(TEST_PYTHON_SRC) - out_f.close() + self.write_file(os.path.join(full_pkg_dir, "src", "module.py"), + TEST_PYTHON_SRC) files = [os.path.join(pkg_dir, 'a.txt'), os.path.join(pkg_dir, 'setup.py'),