[
https://issues.apache.org/jira/browse/BEAM-5320?focusedWorklogId=174709&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-174709
]
ASF GitHub Bot logged work on BEAM-5320:
----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Dec/18 00:42
Start Date: 13/Dec/18 00:42
Worklog Time Spent: 10m
Work Description: aaltay closed pull request #7262: [BEAM-5320]
[BEAM-6106] Finish Python 3 porting for testing module
URL: https://github.com/apache/beam/pull/7262
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py
b/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py
index 21e9c48f302c..f7eb93ba609b 100644
--- a/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py
+++ b/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py
@@ -41,7 +41,7 @@ class BigqueryTornadoesIT(unittest.TestCase):
# The default checksum is a SHA-1 hash generated from sorted rows reading
# from expected Bigquery table.
- DEFAULT_CHECKSUM = '83789a7c1bca7959dcf23d3bc37e9204e594330f'
+ DEFAULT_CHECKSUM = 'd860e636050c559a16a791aff40d6ad809d4daf0'
@attr('IT')
def test_bigquery_tornadoes_it(self):
diff --git a/sdks/python/apache_beam/testing/synthetic_pipeline.py
b/sdks/python/apache_beam/testing/synthetic_pipeline.py
index 2f8980b82c00..b560f35e1394 100644
--- a/sdks/python/apache_beam/testing/synthetic_pipeline.py
+++ b/sdks/python/apache_beam/testing/synthetic_pipeline.py
@@ -71,7 +71,7 @@ def div_round_up(a, b):
def rotate_key(element):
"""Returns a new key-value pair of the same size but with a different key."""
(key, value) = element
- return key[-1] + key[:-1], value
+ return key[-1:] + key[:-1], value
class SyntheticStep(beam.DoFn):
diff --git a/sdks/python/apache_beam/testing/synthetic_pipeline_test.py
b/sdks/python/apache_beam/testing/synthetic_pipeline_test.py
index fe5e94a78cd5..e78655384120 100644
--- a/sdks/python/apache_beam/testing/synthetic_pipeline_test.py
+++ b/sdks/python/apache_beam/testing/synthetic_pipeline_test.py
@@ -125,7 +125,7 @@ def run_pipeline(self, barrier, writes_output=True):
if writes_output:
read_output = []
for file_name in glob.glob(output_location + '*'):
- with open(file_name, 'r') as f:
+ with open(file_name, 'rb') as f:
read_output.extend(f.read().splitlines())
self.assertEqual(10, len(read_output))
diff --git a/sdks/python/apache_beam/testing/test_utils.py
b/sdks/python/apache_beam/testing/test_utils.py
index 1f0e99eec24a..f9aa128d0585 100644
--- a/sdks/python/apache_beam/testing/test_utils.py
+++ b/sdks/python/apache_beam/testing/test_utils.py
@@ -75,11 +75,14 @@ def create_temp_file(self, suffix='', lines=None):
def compute_hash(content, hashing_alg=DEFAULT_HASHING_ALG):
- """Compute a hash value from a list of string."""
+ """Compute a hash value of a list of objects by hashing their string
+ representations."""
+ content = [str(x).encode('utf-8') if not isinstance(x, bytes) else x
+ for x in content]
content.sort()
m = hashlib.new(hashing_alg)
for elem in content:
- m.update(str(elem).encode('utf-8'))
+ m.update(elem)
return m.hexdigest()
diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini
index a357a2f12111..2818870bc5a9 100644
--- a/sdks/python/tox.ini
+++ b/sdks/python/tox.ini
@@ -58,7 +58,7 @@ setenv =
BEAM_EXPERIMENTAL_PY3=1
RUN_SKIPPED_PY3_TESTS=0
modules =
-
apache_beam.typehints,apache_beam.coders,apache_beam.options,apache_beam.tools,apache_beam.utils,apache_beam.internal,apache_beam.metrics,apache_beam.portability,apache_beam.pipeline_test,apache_beam.pvalue_test,apache_beam.runners,apache_beam.io.hadoopfilesystem_test,apache_beam.io.hdfs_integration_test,apache_beam.io.gcp.tests.utils_test,apache_beam.io.gcp.big_query_query_to_table_it_test,apache_beam.io.gcp.bigquery_io_read_it_test,apache_beam.io.gcp.bigquery_test,apache_beam.io.gcp.gcsfilesystem_test,apache_beam.io.gcp.gcsio_test,apache_beam.io.gcp.pubsub_integration_test,apache_beam.io.hdfs_integration_test,apache_beam.io.gcp.internal,apache_beam.io.filesystem_test,apache_beam.io.filesystems,apache_beam.io.range_trackers_test,apache_beam.io.sources_test,apache_beam.transforms
+
apache_beam.typehints,apache_beam.coders,apache_beam.options,apache_beam.tools,apache_beam.utils,apache_beam.internal,apache_beam.metrics,apache_beam.portability,apache_beam.pipeline_test,apache_beam.pvalue_test,apache_beam.runners,apache_beam.io.hadoopfilesystem_test,apache_beam.io.hdfs_integration_test,apache_beam.io.gcp.tests.utils_test,apache_beam.io.gcp.big_query_query_to_table_it_test,apache_beam.io.gcp.bigquery_io_read_it_test,apache_beam.io.gcp.bigquery_test,apache_beam.io.gcp.gcsfilesystem_test,apache_beam.io.gcp.gcsio_test,apache_beam.io.gcp.pubsub_integration_test,apache_beam.io.hdfs_integration_test,apache_beam.io.gcp.internal,apache_beam.io.filesystem_test,apache_beam.io.filesystems,apache_beam.io.range_trackers_test,apache_beam.io.sources_test,apache_beam.transforms,apache_beam.testing
commands =
python --version
pip --version
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 174709)
Time Spent: 5h 40m (was: 5.5h)
> Finish Python 3 porting for testing module
> ------------------------------------------
>
> Key: BEAM-5320
> URL: https://issues.apache.org/jira/browse/BEAM-5320
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-py-core
> Reporter: Robbe
> Assignee: Robbe
> Priority: Major
> Fix For: Not applicable
>
> Time Spent: 5h 40m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)