From a573c8eb784a097d1f492672fe40c7196f00de05 Mon Sep 17 00:00:00 2001 From: Mark Liu Date: Tue, 9 May 2017 16:41:46 -0700 Subject: [PATCH] [BEAM-2236] Move test utilities out of python core --- .../apache_beam/coders/standard_coders_test.py | 2 +- .../examples/complete/autocomplete_test.py | 2 +- .../examples/complete/estimate_pi_test.py | 2 +- .../complete/game/hourly_team_score_test.py | 2 +- .../examples/complete/game/user_score_test.py | 2 +- .../apache_beam/examples/complete/tfidf_test.py | 2 +- .../complete/top_wikipedia_sessions_test.py | 2 +- .../examples/cookbook/bigquery_side_input_test.py | 2 +- .../examples/cookbook/bigquery_tornadoes_it_test.py | 4 ++-- .../examples/cookbook/bigquery_tornadoes_test.py | 2 +- .../apache_beam/examples/cookbook/coders_test.py | 2 +- .../apache_beam/examples/cookbook/combiners_test.py | 2 +- .../examples/cookbook/custom_ptransform_test.py | 2 +- .../apache_beam/examples/cookbook/filters_test.py | 2 +- .../apache_beam/examples/snippets/snippets.py | 2 +- .../apache_beam/examples/snippets/snippets_test.py | 2 +- .../apache_beam/examples/wordcount_it_test.py | 6 +++--- sdks/python/apache_beam/io/avroio_test.py | 2 +- sdks/python/apache_beam/io/concat_source_test.py | 2 +- sdks/python/apache_beam/io/filebasedsource_test.py | 6 +++--- sdks/python/apache_beam/io/fileio_test.py | 2 +- .../apache_beam/io/gcp/datastore/v1/helper_test.py | 2 +- .../apache_beam/io/gcp/tests/bigquery_matcher.py | 2 +- .../io/gcp/tests/bigquery_matcher_test.py | 2 +- sdks/python/apache_beam/io/sources_test.py | 2 +- sdks/python/apache_beam/io/textio_test.py | 2 +- sdks/python/apache_beam/io/tfrecordio_test.py | 2 +- sdks/python/apache_beam/pipeline_test.py | 2 +- sdks/python/apache_beam/pvalue_test.py | 2 +- .../runners/dataflow/dataflow_runner_test.py | 4 ++-- .../apache_beam/{tests => testing}/__init__.py | 0 .../{tests => testing}/data/privatekey.p12 | Bin .../{tests => testing}/data/standard_coders.yaml | 0 .../{tests => testing}/pipeline_verifiers.py | 2 +- .../{tests => testing}/pipeline_verifiers_test.py | 6 +++--- .../apache_beam/{ => testing}/test_pipeline.py | 0 .../apache_beam/{ => testing}/test_pipeline_test.py | 2 +- .../apache_beam/{utils => testing}/test_stream.py | 0 .../{utils => testing}/test_stream_test.py | 8 ++++---- .../apache_beam/{tests => testing}/test_utils.py | 0 .../python/apache_beam/transforms/combiners_test.py | 2 +- sdks/python/apache_beam/transforms/create_test.py | 2 +- .../apache_beam/transforms/ptransform_test.py | 2 +- .../apache_beam/transforms/sideinputs_test.py | 2 +- sdks/python/apache_beam/transforms/trigger_test.py | 2 +- sdks/python/apache_beam/transforms/util_test.py | 2 +- sdks/python/apache_beam/transforms/window_test.py | 2 +- .../apache_beam/transforms/write_ptransform_test.py | 2 +- .../apache_beam/typehints/typed_pipeline_test.py | 4 ++-- sdks/python/setup.py | 2 +- 50 files changed, 56 insertions(+), 56 deletions(-) rename sdks/python/apache_beam/{tests => testing}/__init__.py (100%) rename sdks/python/apache_beam/{tests => testing}/data/privatekey.p12 (100%) rename sdks/python/apache_beam/{tests => testing}/data/standard_coders.yaml (100%) rename sdks/python/apache_beam/{tests => testing}/pipeline_verifiers.py (98%) rename sdks/python/apache_beam/{tests => testing}/pipeline_verifiers_test.py (98%) rename sdks/python/apache_beam/{ => testing}/test_pipeline.py (100%) rename sdks/python/apache_beam/{ => testing}/test_pipeline_test.py (98%) rename sdks/python/apache_beam/{utils => testing}/test_stream.py (100%) rename sdks/python/apache_beam/{utils => testing}/test_stream_test.py (92%) rename sdks/python/apache_beam/{tests => testing}/test_utils.py (100%) diff --git a/sdks/python/apache_beam/coders/standard_coders_test.py b/sdks/python/apache_beam/coders/standard_coders_test.py index 4a48ed91b108..885e88f6eea5 100644 --- a/sdks/python/apache_beam/coders/standard_coders_test.py +++ b/sdks/python/apache_beam/coders/standard_coders_test.py @@ -34,7 +34,7 @@ from apache_beam.transforms import window STANDARD_CODERS_YAML = os.path.join( - os.path.dirname(__file__), '..', 'tests', 'data', 'standard_coders.yaml') + os.path.dirname(__file__), '..', 'testing', 'data', 'standard_coders.yaml') def _load_test_cases(test_yaml): diff --git a/sdks/python/apache_beam/examples/complete/autocomplete_test.py b/sdks/python/apache_beam/examples/complete/autocomplete_test.py index d59d0f534f88..438633a25690 100644 --- a/sdks/python/apache_beam/examples/complete/autocomplete_test.py +++ b/sdks/python/apache_beam/examples/complete/autocomplete_test.py @@ -21,7 +21,7 @@ import apache_beam as beam from apache_beam.examples.complete import autocomplete -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that from apache_beam.transforms.util import equal_to diff --git a/sdks/python/apache_beam/examples/complete/estimate_pi_test.py b/sdks/python/apache_beam/examples/complete/estimate_pi_test.py index dc5b90196edc..12d83794fefe 100644 --- a/sdks/python/apache_beam/examples/complete/estimate_pi_test.py +++ b/sdks/python/apache_beam/examples/complete/estimate_pi_test.py @@ -21,7 +21,7 @@ import unittest from apache_beam.examples.complete import estimate_pi -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that from apache_beam.transforms.util import BeamAssertException diff --git a/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py b/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py index 0eaa8c66d5b0..bd0abcaa1a2b 100644 --- a/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py +++ b/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py @@ -21,8 +21,8 @@ import unittest import apache_beam as beam -from apache_beam.test_pipeline import TestPipeline from apache_beam.examples.complete.game import hourly_team_score +from apache_beam.testing.test_pipeline import TestPipeline class HourlyTeamScoreTest(unittest.TestCase): diff --git a/sdks/python/apache_beam/examples/complete/game/user_score_test.py b/sdks/python/apache_beam/examples/complete/game/user_score_test.py index 750729dcc99b..2db53bdfb837 100644 --- a/sdks/python/apache_beam/examples/complete/game/user_score_test.py +++ b/sdks/python/apache_beam/examples/complete/game/user_score_test.py @@ -21,8 +21,8 @@ import unittest import apache_beam as beam -from apache_beam.test_pipeline import TestPipeline from apache_beam.examples.complete.game import user_score +from apache_beam.testing.test_pipeline import TestPipeline class UserScoreTest(unittest.TestCase): diff --git a/sdks/python/apache_beam/examples/complete/tfidf_test.py b/sdks/python/apache_beam/examples/complete/tfidf_test.py index 05e53a4ba3f9..0e3025459445 100644 --- a/sdks/python/apache_beam/examples/complete/tfidf_test.py +++ b/sdks/python/apache_beam/examples/complete/tfidf_test.py @@ -25,7 +25,7 @@ import apache_beam as beam from apache_beam.examples.complete import tfidf -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline EXPECTED_RESULTS = set([ diff --git a/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py b/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py index 9b9d9b1d0bc4..4850c04cee98 100644 --- a/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py +++ b/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py @@ -23,7 +23,7 @@ import apache_beam as beam from apache_beam.examples.complete import top_wikipedia_sessions -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline class ComputeTopSessionsTest(unittest.TestCase): diff --git a/sdks/python/apache_beam/examples/cookbook/bigquery_side_input_test.py b/sdks/python/apache_beam/examples/cookbook/bigquery_side_input_test.py index 586997648145..1ca25c9e14e9 100644 --- a/sdks/python/apache_beam/examples/cookbook/bigquery_side_input_test.py +++ b/sdks/python/apache_beam/examples/cookbook/bigquery_side_input_test.py @@ -22,7 +22,7 @@ import apache_beam as beam from apache_beam.examples.cookbook import bigquery_side_input -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline class BigQuerySideInputTest(unittest.TestCase): 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 3e302d1ede60..5d2ee7c2cef8 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 @@ -26,8 +26,8 @@ from apache_beam.examples.cookbook import bigquery_tornadoes from apache_beam.io.gcp.tests.bigquery_matcher import BigqueryMatcher -from apache_beam.test_pipeline import TestPipeline -from apache_beam.tests.pipeline_verifiers import PipelineStateMatcher +from apache_beam.testing.pipeline_verifiers import PipelineStateMatcher +from apache_beam.testing.test_pipeline import TestPipeline class BigqueryTornadoesIT(unittest.TestCase): diff --git a/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_test.py b/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_test.py index 0c66d7e198f9..ca7ca9e2e74d 100644 --- a/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_test.py +++ b/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_test.py @@ -22,7 +22,7 @@ import apache_beam as beam from apache_beam.examples.cookbook import bigquery_tornadoes -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline class BigQueryTornadoesTest(unittest.TestCase): diff --git a/sdks/python/apache_beam/examples/cookbook/coders_test.py b/sdks/python/apache_beam/examples/cookbook/coders_test.py index 4a92abbdca24..35cf252575d4 100644 --- a/sdks/python/apache_beam/examples/cookbook/coders_test.py +++ b/sdks/python/apache_beam/examples/cookbook/coders_test.py @@ -22,7 +22,7 @@ import apache_beam as beam from apache_beam.examples.cookbook import coders -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that from apache_beam.transforms.util import equal_to diff --git a/sdks/python/apache_beam/examples/cookbook/combiners_test.py b/sdks/python/apache_beam/examples/cookbook/combiners_test.py index a8ed5550ccc8..45c779fd5159 100644 --- a/sdks/python/apache_beam/examples/cookbook/combiners_test.py +++ b/sdks/python/apache_beam/examples/cookbook/combiners_test.py @@ -27,7 +27,7 @@ import unittest import apache_beam as beam -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline class CombinersTest(unittest.TestCase): diff --git a/sdks/python/apache_beam/examples/cookbook/custom_ptransform_test.py b/sdks/python/apache_beam/examples/cookbook/custom_ptransform_test.py index cd1c04ac6cdb..2d35d8d29d2a 100644 --- a/sdks/python/apache_beam/examples/cookbook/custom_ptransform_test.py +++ b/sdks/python/apache_beam/examples/cookbook/custom_ptransform_test.py @@ -22,7 +22,7 @@ import apache_beam as beam from apache_beam.examples.cookbook import custom_ptransform -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that from apache_beam.transforms.util import equal_to diff --git a/sdks/python/apache_beam/examples/cookbook/filters_test.py b/sdks/python/apache_beam/examples/cookbook/filters_test.py index 28bb1e14aecd..44a352f19e64 100644 --- a/sdks/python/apache_beam/examples/cookbook/filters_test.py +++ b/sdks/python/apache_beam/examples/cookbook/filters_test.py @@ -22,7 +22,7 @@ import apache_beam as beam from apache_beam.examples.cookbook import filters -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline class FiltersTest(unittest.TestCase): diff --git a/sdks/python/apache_beam/examples/snippets/snippets.py b/sdks/python/apache_beam/examples/snippets/snippets.py index 26af71da883e..1bdb9a366bf0 100644 --- a/sdks/python/apache_beam/examples/snippets/snippets.py +++ b/sdks/python/apache_beam/examples/snippets/snippets.py @@ -31,8 +31,8 @@ """ import apache_beam as beam -from apache_beam.test_pipeline import TestPipeline from apache_beam.metrics import Metrics +from apache_beam.testing.test_pipeline import TestPipeline # Quiet some pylint warnings that happen because of the somewhat special # format for the code snippets. diff --git a/sdks/python/apache_beam/examples/snippets/snippets_test.py b/sdks/python/apache_beam/examples/snippets/snippets_test.py index da0a9625cfda..85d8bde186fb 100644 --- a/sdks/python/apache_beam/examples/snippets/snippets_test.py +++ b/sdks/python/apache_beam/examples/snippets/snippets_test.py @@ -36,7 +36,7 @@ from apache_beam.utils.windowed_value import WindowedValue # pylint: disable=expression-not-assigned -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline # Protect against environments where apitools library is not available. # pylint: disable=wrong-import-order, wrong-import-position diff --git a/sdks/python/apache_beam/examples/wordcount_it_test.py b/sdks/python/apache_beam/examples/wordcount_it_test.py index 54e54e8b00da..4bee1279c8f0 100644 --- a/sdks/python/apache_beam/examples/wordcount_it_test.py +++ b/sdks/python/apache_beam/examples/wordcount_it_test.py @@ -25,9 +25,9 @@ from nose.plugins.attrib import attr from apache_beam.examples import wordcount -from apache_beam.test_pipeline import TestPipeline -from apache_beam.tests.pipeline_verifiers import PipelineStateMatcher -from apache_beam.tests.pipeline_verifiers import FileChecksumMatcher +from apache_beam.testing.pipeline_verifiers import FileChecksumMatcher +from apache_beam.testing.pipeline_verifiers import PipelineStateMatcher +from apache_beam.testing.test_pipeline import TestPipeline class WordCountIT(unittest.TestCase): diff --git a/sdks/python/apache_beam/io/avroio_test.py b/sdks/python/apache_beam/io/avroio_test.py index 5f2db6268113..4a2183928b98 100644 --- a/sdks/python/apache_beam/io/avroio_test.py +++ b/sdks/python/apache_beam/io/avroio_test.py @@ -26,7 +26,7 @@ from apache_beam.io import avroio from apache_beam.io import filebasedsource from apache_beam.io import source_test_utils -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.display import DisplayData from apache_beam.transforms.display_test import DisplayDataItemMatcher from apache_beam.transforms.util import assert_that diff --git a/sdks/python/apache_beam/io/concat_source_test.py b/sdks/python/apache_beam/io/concat_source_test.py index 807c3fd8e4ce..a02f9ad64663 100644 --- a/sdks/python/apache_beam/io/concat_source_test.py +++ b/sdks/python/apache_beam/io/concat_source_test.py @@ -26,7 +26,7 @@ from apache_beam.io import range_trackers from apache_beam.io import source_test_utils from apache_beam.io.concat_source import ConcatSource -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that from apache_beam.transforms.util import equal_to diff --git a/sdks/python/apache_beam/io/filebasedsource_test.py b/sdks/python/apache_beam/io/filebasedsource_test.py index 4ff23fc3d6a4..e17a004a3430 100644 --- a/sdks/python/apache_beam/io/filebasedsource_test.py +++ b/sdks/python/apache_beam/io/filebasedsource_test.py @@ -38,13 +38,13 @@ from apache_beam.io.filebasedsource import _SingleFileSource as SingleFileSource from apache_beam.io.filebasedsource import FileBasedSource -from apache_beam.test_pipeline import TestPipeline +from apache_beam.options.value_provider import StaticValueProvider +from apache_beam.options.value_provider import RuntimeValueProvider +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.display import DisplayData from apache_beam.transforms.display_test import DisplayDataItemMatcher from apache_beam.transforms.util import assert_that from apache_beam.transforms.util import equal_to -from apache_beam.options.value_provider import StaticValueProvider -from apache_beam.options.value_provider import RuntimeValueProvider class LineSource(FileBasedSource): diff --git a/sdks/python/apache_beam/io/fileio_test.py b/sdks/python/apache_beam/io/fileio_test.py index e0e9774dd255..4c25505d5212 100644 --- a/sdks/python/apache_beam/io/fileio_test.py +++ b/sdks/python/apache_beam/io/fileio_test.py @@ -31,7 +31,7 @@ import apache_beam as beam from apache_beam import coders from apache_beam.io import fileio -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.display import DisplayData from apache_beam.transforms.display_test import DisplayDataItemMatcher diff --git a/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py b/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py index 5d4bb6f6495c..a804c09c7495 100644 --- a/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py +++ b/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py @@ -23,7 +23,7 @@ from apache_beam.io.gcp.datastore.v1 import fake_datastore from apache_beam.io.gcp.datastore.v1 import helper -from apache_beam.tests.test_utils import patch_retry +from apache_beam.testing.test_utils import patch_retry # Protect against environments where apitools library is not available. diff --git a/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher.py b/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher.py index 66d99b3ab7aa..f42b70fc19f4 100644 --- a/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher.py +++ b/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher.py @@ -21,7 +21,7 @@ from hamcrest.core.base_matcher import BaseMatcher -from apache_beam.tests.test_utils import compute_hash +from apache_beam.testing.test_utils import compute_hash from apache_beam.utils import retry # Protect against environments where bigquery library is not available. diff --git a/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py b/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py index d8aa1489dc15..f12293e491c8 100644 --- a/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py +++ b/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py @@ -24,7 +24,7 @@ from mock import Mock, patch from apache_beam.io.gcp.tests import bigquery_matcher as bq_verifier -from apache_beam.tests.test_utils import patch_retry +from apache_beam.testing.test_utils import patch_retry # Protect against environments where bigquery library is not available. # pylint: disable=wrong-import-order, wrong-import-position diff --git a/sdks/python/apache_beam/io/sources_test.py b/sdks/python/apache_beam/io/sources_test.py index 3f92756979b3..c0b8ad620dc8 100644 --- a/sdks/python/apache_beam/io/sources_test.py +++ b/sdks/python/apache_beam/io/sources_test.py @@ -27,7 +27,7 @@ from apache_beam import coders from apache_beam.io import iobase from apache_beam.io import range_trackers -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that from apache_beam.transforms.util import equal_to diff --git a/sdks/python/apache_beam/io/textio_test.py b/sdks/python/apache_beam/io/textio_test.py index 90dc6652fa47..d00afef6c033 100644 --- a/sdks/python/apache_beam/io/textio_test.py +++ b/sdks/python/apache_beam/io/textio_test.py @@ -43,7 +43,7 @@ from apache_beam.io.filebasedsource_test import write_pattern from apache_beam.io.filesystem import CompressionTypes -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that from apache_beam.transforms.util import equal_to diff --git a/sdks/python/apache_beam/io/tfrecordio_test.py b/sdks/python/apache_beam/io/tfrecordio_test.py index 29a9fb8342a0..b7e370d0187a 100644 --- a/sdks/python/apache_beam/io/tfrecordio_test.py +++ b/sdks/python/apache_beam/io/tfrecordio_test.py @@ -35,7 +35,7 @@ from apache_beam.io.tfrecordio import _TFRecordUtil from apache_beam.io.tfrecordio import ReadFromTFRecord from apache_beam.io.tfrecordio import WriteToTFRecord -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline import crcmod diff --git a/sdks/python/apache_beam/pipeline_test.py b/sdks/python/apache_beam/pipeline_test.py index ebcc43b5b2fb..c6b1e48fb5b5 100644 --- a/sdks/python/apache_beam/pipeline_test.py +++ b/sdks/python/apache_beam/pipeline_test.py @@ -32,7 +32,7 @@ from apache_beam.pipeline import PipelineVisitor from apache_beam.pvalue import AsSingleton from apache_beam.runners.dataflow.native_io.iobase import NativeSource -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms import CombineGlobally from apache_beam.transforms import Create from apache_beam.transforms import FlatMap diff --git a/sdks/python/apache_beam/pvalue_test.py b/sdks/python/apache_beam/pvalue_test.py index 529ddf773c2c..4acbc52c2237 100644 --- a/sdks/python/apache_beam/pvalue_test.py +++ b/sdks/python/apache_beam/pvalue_test.py @@ -20,7 +20,7 @@ import unittest from apache_beam.pvalue import PValue -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline class PValueTest(unittest.TestCase): diff --git a/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py b/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py index a9f61a7ce7d7..b61a683f9689 100644 --- a/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py +++ b/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py @@ -26,6 +26,7 @@ import apache_beam as beam import apache_beam.transforms as ptransform +from apache_beam.options.pipeline_options import PipelineOptions from apache_beam.pipeline import Pipeline, AppliedPTransform from apache_beam.pvalue import PCollection from apache_beam.runners import create_runner @@ -34,10 +35,9 @@ from apache_beam.runners.dataflow.dataflow_runner import DataflowPipelineResult from apache_beam.runners.dataflow.dataflow_runner import DataflowRuntimeException from apache_beam.runners.dataflow.internal.clients import dataflow as dataflow_api -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.display import DisplayDataItem from apache_beam.typehints import typehints -from apache_beam.options.pipeline_options import PipelineOptions # Protect against environments where apitools library is not available. # pylint: disable=wrong-import-order, wrong-import-position diff --git a/sdks/python/apache_beam/tests/__init__.py b/sdks/python/apache_beam/testing/__init__.py similarity index 100% rename from sdks/python/apache_beam/tests/__init__.py rename to sdks/python/apache_beam/testing/__init__.py diff --git a/sdks/python/apache_beam/tests/data/privatekey.p12 b/sdks/python/apache_beam/testing/data/privatekey.p12 similarity index 100% rename from sdks/python/apache_beam/tests/data/privatekey.p12 rename to sdks/python/apache_beam/testing/data/privatekey.p12 diff --git a/sdks/python/apache_beam/tests/data/standard_coders.yaml b/sdks/python/apache_beam/testing/data/standard_coders.yaml similarity index 100% rename from sdks/python/apache_beam/tests/data/standard_coders.yaml rename to sdks/python/apache_beam/testing/data/standard_coders.yaml diff --git a/sdks/python/apache_beam/tests/pipeline_verifiers.py b/sdks/python/apache_beam/testing/pipeline_verifiers.py similarity index 98% rename from sdks/python/apache_beam/tests/pipeline_verifiers.py rename to sdks/python/apache_beam/testing/pipeline_verifiers.py index df05054c22dd..5a6082aaee50 100644 --- a/sdks/python/apache_beam/tests/pipeline_verifiers.py +++ b/sdks/python/apache_beam/testing/pipeline_verifiers.py @@ -29,7 +29,7 @@ from apache_beam.io.filesystems import FileSystems from apache_beam.runners.runner import PipelineState -from apache_beam.tests import test_utils as utils +from apache_beam.testing import test_utils as utils from apache_beam.utils import retry try: diff --git a/sdks/python/apache_beam/tests/pipeline_verifiers_test.py b/sdks/python/apache_beam/testing/pipeline_verifiers_test.py similarity index 98% rename from sdks/python/apache_beam/tests/pipeline_verifiers_test.py rename to sdks/python/apache_beam/testing/pipeline_verifiers_test.py index 909917dc53cf..15e0a042008b 100644 --- a/sdks/python/apache_beam/tests/pipeline_verifiers_test.py +++ b/sdks/python/apache_beam/testing/pipeline_verifiers_test.py @@ -25,10 +25,10 @@ from mock import Mock, patch from apache_beam.io.localfilesystem import LocalFileSystem -from apache_beam.runners.runner import PipelineState from apache_beam.runners.runner import PipelineResult -from apache_beam.tests import pipeline_verifiers as verifiers -from apache_beam.tests.test_utils import patch_retry +from apache_beam.runners.runner import PipelineState +from apache_beam.testing.test_utils import patch_retry +from apache_beam.testing import pipeline_verifiers as verifiers try: # pylint: disable=wrong-import-order, wrong-import-position diff --git a/sdks/python/apache_beam/test_pipeline.py b/sdks/python/apache_beam/testing/test_pipeline.py similarity index 100% rename from sdks/python/apache_beam/test_pipeline.py rename to sdks/python/apache_beam/testing/test_pipeline.py diff --git a/sdks/python/apache_beam/test_pipeline_test.py b/sdks/python/apache_beam/testing/test_pipeline_test.py similarity index 98% rename from sdks/python/apache_beam/test_pipeline_test.py rename to sdks/python/apache_beam/testing/test_pipeline_test.py index 325cab789518..747d64c7409f 100644 --- a/sdks/python/apache_beam/test_pipeline_test.py +++ b/sdks/python/apache_beam/testing/test_pipeline_test.py @@ -24,7 +24,7 @@ from hamcrest.core.assert_that import assert_that as hc_assert_that from apache_beam.internal import pickler -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.options.pipeline_options import PipelineOptions diff --git a/sdks/python/apache_beam/utils/test_stream.py b/sdks/python/apache_beam/testing/test_stream.py similarity index 100% rename from sdks/python/apache_beam/utils/test_stream.py rename to sdks/python/apache_beam/testing/test_stream.py diff --git a/sdks/python/apache_beam/utils/test_stream_test.py b/sdks/python/apache_beam/testing/test_stream_test.py similarity index 92% rename from sdks/python/apache_beam/utils/test_stream_test.py rename to sdks/python/apache_beam/testing/test_stream_test.py index b5b5c697e554..e32dda2aeb26 100644 --- a/sdks/python/apache_beam/utils/test_stream_test.py +++ b/sdks/python/apache_beam/testing/test_stream_test.py @@ -19,12 +19,12 @@ import unittest +from apache_beam.testing.test_stream import ElementEvent +from apache_beam.testing.test_stream import ProcessingTimeEvent +from apache_beam.testing.test_stream import TestStream +from apache_beam.testing.test_stream import WatermarkEvent from apache_beam.transforms.window import TimestampedValue from apache_beam.utils import timestamp -from apache_beam.utils.test_stream import ElementEvent -from apache_beam.utils.test_stream import ProcessingTimeEvent -from apache_beam.utils.test_stream import TestStream -from apache_beam.utils.test_stream import WatermarkEvent from apache_beam.utils.windowed_value import WindowedValue diff --git a/sdks/python/apache_beam/tests/test_utils.py b/sdks/python/apache_beam/testing/test_utils.py similarity index 100% rename from sdks/python/apache_beam/tests/test_utils.py rename to sdks/python/apache_beam/testing/test_utils.py diff --git a/sdks/python/apache_beam/transforms/combiners_test.py b/sdks/python/apache_beam/transforms/combiners_test.py index af768891c84f..1822c1911927 100644 --- a/sdks/python/apache_beam/transforms/combiners_test.py +++ b/sdks/python/apache_beam/transforms/combiners_test.py @@ -22,7 +22,7 @@ import hamcrest as hc import apache_beam as beam -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline import apache_beam.transforms.combiners as combine from apache_beam.transforms.core import CombineGlobally from apache_beam.transforms.core import Create diff --git a/sdks/python/apache_beam/transforms/create_test.py b/sdks/python/apache_beam/transforms/create_test.py index 2352acd3c53f..9ede4c7d2d41 100644 --- a/sdks/python/apache_beam/transforms/create_test.py +++ b/sdks/python/apache_beam/transforms/create_test.py @@ -22,7 +22,7 @@ from apache_beam import Create, assert_that, equal_to from apache_beam.coders import FastPrimitivesCoder -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline class CreateTest(unittest.TestCase): diff --git a/sdks/python/apache_beam/transforms/ptransform_test.py b/sdks/python/apache_beam/transforms/ptransform_test.py index 5948460579de..137992dd428b 100644 --- a/sdks/python/apache_beam/transforms/ptransform_test.py +++ b/sdks/python/apache_beam/transforms/ptransform_test.py @@ -32,7 +32,7 @@ from apache_beam.io.iobase import Read from apache_beam.options.pipeline_options import TypeOptions import apache_beam.pvalue as pvalue -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms import window import apache_beam.transforms.combiners as combine from apache_beam.transforms.display import DisplayData, DisplayDataItem diff --git a/sdks/python/apache_beam/transforms/sideinputs_test.py b/sdks/python/apache_beam/transforms/sideinputs_test.py index bf9aeff084ee..0bc910799571 100644 --- a/sdks/python/apache_beam/transforms/sideinputs_test.py +++ b/sdks/python/apache_beam/transforms/sideinputs_test.py @@ -23,7 +23,7 @@ from nose.plugins.attrib import attr import apache_beam as beam -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms import window from apache_beam.transforms.util import assert_that, equal_to diff --git a/sdks/python/apache_beam/transforms/trigger_test.py b/sdks/python/apache_beam/transforms/trigger_test.py index 38871fed3abd..2574c4bdc7ba 100644 --- a/sdks/python/apache_beam/transforms/trigger_test.py +++ b/sdks/python/apache_beam/transforms/trigger_test.py @@ -26,7 +26,7 @@ import apache_beam as beam from apache_beam.runners import pipeline_context -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms import trigger from apache_beam.transforms.core import Windowing from apache_beam.transforms.trigger import AccumulationMode diff --git a/sdks/python/apache_beam/transforms/util_test.py b/sdks/python/apache_beam/transforms/util_test.py index 965682786321..7fdef702871f 100644 --- a/sdks/python/apache_beam/transforms/util_test.py +++ b/sdks/python/apache_beam/transforms/util_test.py @@ -20,7 +20,7 @@ import unittest from apache_beam import Create -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that, equal_to, is_empty diff --git a/sdks/python/apache_beam/transforms/window_test.py b/sdks/python/apache_beam/transforms/window_test.py index 2d2b03d90ed8..a7797dd435d9 100644 --- a/sdks/python/apache_beam/transforms/window_test.py +++ b/sdks/python/apache_beam/transforms/window_test.py @@ -20,7 +20,7 @@ import unittest from apache_beam.runners import pipeline_context -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms import CombinePerKey from apache_beam.transforms import combiners from apache_beam.transforms import core diff --git a/sdks/python/apache_beam/transforms/write_ptransform_test.py b/sdks/python/apache_beam/transforms/write_ptransform_test.py index 3d7fbd94f336..27e7caa8e5a7 100644 --- a/sdks/python/apache_beam/transforms/write_ptransform_test.py +++ b/sdks/python/apache_beam/transforms/write_ptransform_test.py @@ -22,7 +22,7 @@ import apache_beam as beam from apache_beam.io import iobase -from apache_beam.test_pipeline import TestPipeline +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.ptransform import PTransform from apache_beam.transforms.util import assert_that, is_empty diff --git a/sdks/python/apache_beam/typehints/typed_pipeline_test.py b/sdks/python/apache_beam/typehints/typed_pipeline_test.py index 3812fb1270e2..3494cfe1e6a8 100644 --- a/sdks/python/apache_beam/typehints/typed_pipeline_test.py +++ b/sdks/python/apache_beam/typehints/typed_pipeline_test.py @@ -23,10 +23,10 @@ import apache_beam as beam from apache_beam import pvalue from apache_beam import typehints -from apache_beam.test_pipeline import TestPipeline +from apache_beam.options.pipeline_options import OptionsContext +from apache_beam.testing.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that, equal_to from apache_beam.typehints import WithTypeHints -from apache_beam.options.pipeline_options import OptionsContext # These test often construct a pipeline as value | PTransform to test side # effects (e.g. errors). diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 681abbfce96b..9bf3cf4d37e9 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -122,7 +122,7 @@ def get_version(): author_email=PACKAGE_EMAIL, packages=setuptools.find_packages(), package_data={'apache_beam': [ - '*/*.pyx', '*/*/*.pyx', '*/*.pxd', '*/*/*.pxd', 'tests/data/*']}, + '*/*.pyx', '*/*/*.pyx', '*/*.pxd', '*/*/*.pxd', 'testing/data/*']}, ext_modules=cythonize([ 'apache_beam/**/*.pyx', 'apache_beam/coders/coder_impl.py',