You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2017/01/26 00:17:28 UTC
[1/2] beam git commit: Closes #1844
Repository: beam
Updated Branches:
refs/heads/python-sdk 592422059 -> 4e1028b3d
Closes #1844
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/4e1028b3
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/4e1028b3
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/4e1028b3
Branch: refs/heads/python-sdk
Commit: 4e1028b3dfeaf02e51eb9f3b5d1a5e78c1cfcbb9
Parents: 5924220 5787e81
Author: Robert Bradshaw <ro...@google.com>
Authored: Wed Jan 25 16:16:52 2017 -0800
Committer: Robert Bradshaw <ro...@google.com>
Committed: Wed Jan 25 16:16:52 2017 -0800
----------------------------------------------------------------------
.../python/apache_beam/utils/dependency_test.py | 47 +++++++++++---------
1 file changed, 27 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
[2/2] beam git commit: Use a temp directory for requirements cache in
test_with_requirements_file
Posted by ro...@apache.org.
Use a temp directory for requirements cache in
test_with_requirements_file
The test fails if there are leftover files in the default folder for
requirements cache either from earlier tests, or from the previous
workspaces.
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/5787e817
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/5787e817
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/5787e817
Branch: refs/heads/python-sdk
Commit: 5787e817a7eda4859963d535df21f2fa00edf8af
Parents: 5924220
Author: Ahmet Altay <al...@google.com>
Authored: Wed Jan 25 09:57:18 2017 -0800
Committer: Robert Bradshaw <ro...@google.com>
Committed: Wed Jan 25 16:16:52 2017 -0800
----------------------------------------------------------------------
.../python/apache_beam/utils/dependency_test.py | 47 +++++++++++---------
1 file changed, 27 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/beam/blob/5787e817/sdks/python/apache_beam/utils/dependency_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/dependency_test.py b/sdks/python/apache_beam/utils/dependency_test.py
index a484d60..75a89e2 100644
--- a/sdks/python/apache_beam/utils/dependency_test.py
+++ b/sdks/python/apache_beam/utils/dependency_test.py
@@ -106,27 +106,34 @@ class SetupTest(unittest.TestCase):
dependency.stage_job_resources(options))
def test_with_requirements_file(self):
- staging_dir = tempfile.mkdtemp()
- source_dir = tempfile.mkdtemp()
+ try:
+ staging_dir = tempfile.mkdtemp()
+ requirements_cache_dir = tempfile.mkdtemp()
+ source_dir = tempfile.mkdtemp()
- options = PipelineOptions()
- options.view_as(GoogleCloudOptions).staging_location = staging_dir
- self.update_options(options)
- options.view_as(SetupOptions).requirements_file = os.path.join(
- source_dir, dependency.REQUIREMENTS_FILE)
- self.create_temp_file(
- os.path.join(source_dir, dependency.REQUIREMENTS_FILE), 'nothing')
- self.assertEqual(
- sorted([dependency.REQUIREMENTS_FILE,
- 'abc.txt', 'def.txt']),
- sorted(dependency.stage_job_resources(
- options,
- populate_requirements_cache=self.populate_requirements_cache)))
- self.assertTrue(
- os.path.isfile(
- os.path.join(staging_dir, dependency.REQUIREMENTS_FILE)))
- self.assertTrue(os.path.isfile(os.path.join(staging_dir, 'abc.txt')))
- self.assertTrue(os.path.isfile(os.path.join(staging_dir, 'def.txt')))
+ options = PipelineOptions()
+ options.view_as(GoogleCloudOptions).staging_location = staging_dir
+ self.update_options(options)
+ options.view_as(SetupOptions).requirements_cache = requirements_cache_dir
+ options.view_as(SetupOptions).requirements_file = os.path.join(
+ source_dir, dependency.REQUIREMENTS_FILE)
+ self.create_temp_file(
+ os.path.join(source_dir, dependency.REQUIREMENTS_FILE), 'nothing')
+ self.assertEqual(
+ sorted([dependency.REQUIREMENTS_FILE,
+ 'abc.txt', 'def.txt']),
+ sorted(dependency.stage_job_resources(
+ options,
+ populate_requirements_cache=self.populate_requirements_cache)))
+ self.assertTrue(
+ os.path.isfile(
+ os.path.join(staging_dir, dependency.REQUIREMENTS_FILE)))
+ self.assertTrue(os.path.isfile(os.path.join(staging_dir, 'abc.txt')))
+ self.assertTrue(os.path.isfile(os.path.join(staging_dir, 'def.txt')))
+ finally:
+ shutil.rmtree(staging_dir)
+ shutil.rmtree(requirements_cache_dir)
+ shutil.rmtree(source_dir)
def test_requirements_file_not_present(self):
staging_dir = tempfile.mkdtemp()