From 6a71a0a95981f24b0cf67e7144cb12dfb6963ff3 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Thu, 4 Apr 2024 13:48:47 -0400 Subject: [PATCH] fix: Move tests under ldclient namespace (#29) Previous distributions of this package included two packages -- ldclient and testing. This top level testing namespace can conflict with other packages. In fact, it conflicts with our own eventsource library. In general this doesn't matter, but it may if: 1. You are using a build process that warns about conflicts (see [this issue][1]) 2. You want to install the sdist on an unsupported platform and would like to be able to verify the tests. To resolve this issue, we are moving the testing folder into the ldclient package. These testing files will only be included in the sdist format. This allows for a smaller wheel size while also allowing for flexibility with consumers. [1]: launchdarkly/python-server-sdk#281 --- Makefile | 2 +- {testing => ldclient/testing}/__init__.py | 0 {testing => ldclient/testing}/builders.py | 0 .../testing}/feature_store_test_base.py | 8 ++++---- {testing => ldclient/testing}/http_util.py | 2 +- {testing => ldclient/testing}/impl/__init__.py | 0 .../testing}/impl/datasource/__init__.py | 0 .../impl/datasource/test_feature_requester.py | 4 ++-- .../impl/datasource/test_polling_processor.py | 6 +++--- .../testing}/impl/datasource/test_streaming.py | 10 +++++----- .../testing}/impl/evaluator_util.py | 2 +- .../testing}/impl/events/__init__.py | 0 .../testing}/impl/events/test_diagnostics.py | 0 .../impl/events/test_event_context_formatter.py | 0 .../testing}/impl/events/test_event_factory.py | 2 +- .../testing}/impl/events/test_event_processor.py | 6 +++--- .../testing}/impl/events/test_event_summarizer.py | 2 +- .../testing}/impl/test_attribute_ref.py | 0 .../testing}/impl/test_big_segments.py | 14 +++++++------- .../testing}/impl/test_data_sink.py | 4 ++-- .../testing}/impl/test_evaluator.py | 6 +++--- .../testing}/impl/test_evaluator_big_segment.py | 6 +++--- .../testing}/impl/test_evaluator_bucketing.py | 10 +++++----- .../testing}/impl/test_evaluator_clause.py | 4 ++-- .../testing}/impl/test_evaluator_prerequisites.py | 4 ++-- .../testing}/impl/test_evaluator_segment.py | 4 ++-- .../testing}/impl/test_evaluator_target.py | 8 ++++---- .../testing}/impl/test_flag_tracker.py | 2 +- .../testing}/impl/test_listeners.py | 0 .../testing}/impl/test_lru_cache.py | 0 .../testing}/impl/test_model_decode.py | 2 +- .../testing}/impl/test_model_encoder.py | 0 .../testing}/impl/test_operators.py | 2 +- .../testing}/impl/test_repeating_task.py | 0 {testing => ldclient/testing}/impl/test_sampler.py | 0 .../testing}/integrations/__init__.py | 0 .../integrations/big_segment_store_test_base.py | 0 .../persistent_feature_store_test_base.py | 12 ++++++------ .../testing}/integrations/test_consul.py | 4 ++-- .../testing}/integrations/test_dynamodb.py | 12 ++++++------ .../testing}/integrations/test_redis.py | 8 ++++---- .../testing}/integrations/test_test_data_source.py | 0 .../testing}/migrations/__init__.py | 0 .../testing}/migrations/test_migrator.py | 4 ++-- .../testing}/migrations/test_migrator_builder.py | 0 .../testing}/migrations/test_op_tracker.py | 4 ++-- {testing => ldclient/testing}/mock_components.py | 0 {testing => ldclient/testing}/proxy_test_util.py | 2 +- {testing => ldclient/testing}/selfsigned.key | 0 {testing => ldclient/testing}/selfsigned.pem | 0 {testing => ldclient/testing}/stub_util.py | 2 +- {testing => ldclient/testing}/sync_util.py | 0 {testing => ldclient/testing}/test_config.py | 0 {testing => ldclient/testing}/test_context.py | 0 .../testing}/test_feature_store_client_wrapper.py | 0 .../testing}/test_feature_store_helpers.py | 0 .../testing}/test_file_data_source.py | 4 ++-- {testing => ldclient/testing}/test_flags_state.py | 0 .../testing}/test_in_memory_feature_store.py | 2 +- {testing => ldclient/testing}/test_init.py | 0 {testing => ldclient/testing}/test_ldclient.py | 4 ++-- .../testing}/test_ldclient_end_to_end.py | 6 +++--- .../testing}/test_ldclient_evaluation.py | 8 ++++---- .../testing}/test_ldclient_events.py | 6 +++--- .../testing}/test_ldclient_listeners.py | 6 +++--- .../testing}/test_ldclient_migration_variation.py | 4 ++-- .../testing}/test_ldclient_singleton.py | 6 +++--- {testing => ldclient/testing}/test_util.py | 0 pyproject.toml | 6 +++--- 69 files changed, 105 insertions(+), 105 deletions(-) rename {testing => ldclient/testing}/__init__.py (100%) rename {testing => ldclient/testing}/builders.py (100%) rename {testing => ldclient/testing}/feature_store_test_base.py (99%) rename {testing => ldclient/testing}/http_util.py (98%) rename {testing => ldclient/testing}/impl/__init__.py (100%) rename {testing => ldclient/testing}/impl/datasource/__init__.py (100%) rename {testing => ldclient/testing}/impl/datasource/test_feature_requester.py (97%) rename {testing => ldclient/testing}/impl/datasource/test_polling_processor.py (96%) rename {testing => ldclient/testing}/impl/datasource/test_streaming.py (97%) rename {testing => ldclient/testing}/impl/evaluator_util.py (98%) rename {testing => ldclient/testing}/impl/events/__init__.py (100%) rename {testing => ldclient/testing}/impl/events/test_diagnostics.py (100%) rename {testing => ldclient/testing}/impl/events/test_event_context_formatter.py (100%) rename {testing => ldclient/testing}/impl/events/test_event_factory.py (98%) rename {testing => ldclient/testing}/impl/events/test_event_processor.py (99%) rename {testing => ldclient/testing}/impl/events/test_event_summarizer.py (97%) rename {testing => ldclient/testing}/impl/test_attribute_ref.py (100%) rename {testing => ldclient/testing}/impl/test_big_segments.py (98%) rename {testing => ldclient/testing}/impl/test_data_sink.py (98%) rename {testing => ldclient/testing}/impl/test_evaluator.py (98%) rename {testing => ldclient/testing}/impl/test_evaluator_big_segment.py (97%) rename {testing => ldclient/testing}/impl/test_evaluator_bucketing.py (98%) rename {testing => ldclient/testing}/impl/test_evaluator_clause.py (97%) rename {testing => ldclient/testing}/impl/test_evaluator_prerequisites.py (97%) rename {testing => ldclient/testing}/impl/test_evaluator_segment.py (98%) rename {testing => ldclient/testing}/impl/test_evaluator_target.py (97%) rename {testing => ldclient/testing}/impl/test_flag_tracker.py (97%) rename {testing => ldclient/testing}/impl/test_listeners.py (100%) rename {testing => ldclient/testing}/impl/test_lru_cache.py (100%) rename {testing => ldclient/testing}/impl/test_model_decode.py (98%) rename {testing => ldclient/testing}/impl/test_model_encoder.py (100%) rename {testing => ldclient/testing}/impl/test_operators.py (99%) rename {testing => ldclient/testing}/impl/test_repeating_task.py (100%) rename {testing => ldclient/testing}/impl/test_sampler.py (100%) rename {testing => ldclient/testing}/integrations/__init__.py (100%) rename {testing => ldclient/testing}/integrations/big_segment_store_test_base.py (100%) rename {testing => ldclient/testing}/integrations/persistent_feature_store_test_base.py (93%) rename {testing => ldclient/testing}/integrations/test_consul.py (91%) rename {testing => ldclient/testing}/integrations/test_dynamodb.py (97%) rename {testing => ldclient/testing}/integrations/test_redis.py (95%) rename {testing => ldclient/testing}/integrations/test_test_data_source.py (100%) rename {testing => ldclient/testing}/migrations/__init__.py (100%) rename {testing => ldclient/testing}/migrations/test_migrator.py (99%) rename {testing => ldclient/testing}/migrations/test_migrator_builder.py (100%) rename {testing => ldclient/testing}/migrations/test_op_tracker.py (98%) rename {testing => ldclient/testing}/mock_components.py (100%) rename {testing => ldclient/testing}/proxy_test_util.py (97%) rename {testing => ldclient/testing}/selfsigned.key (100%) rename {testing => ldclient/testing}/selfsigned.pem (100%) rename {testing => ldclient/testing}/stub_util.py (98%) rename {testing => ldclient/testing}/sync_util.py (100%) rename {testing => ldclient/testing}/test_config.py (100%) rename {testing => ldclient/testing}/test_context.py (100%) rename {testing => ldclient/testing}/test_feature_store_client_wrapper.py (100%) rename {testing => ldclient/testing}/test_feature_store_helpers.py (100%) rename {testing => ldclient/testing}/test_file_data_source.py (98%) rename {testing => ldclient/testing}/test_flags_state.py (100%) rename {testing => ldclient/testing}/test_in_memory_feature_store.py (85%) rename {testing => ldclient/testing}/test_init.py (100%) rename {testing => ldclient/testing}/test_ldclient.py (98%) rename {testing => ldclient/testing}/test_ldclient_end_to_end.py (96%) rename {testing => ldclient/testing}/test_ldclient_evaluation.py (98%) rename {testing => ldclient/testing}/test_ldclient_events.py (97%) rename {testing => ldclient/testing}/test_ldclient_listeners.py (91%) rename {testing => ldclient/testing}/test_ldclient_migration_variation.py (95%) rename {testing => ldclient/testing}/test_ldclient_singleton.py (93%) rename {testing => ldclient/testing}/test_util.py (100%) diff --git a/Makefile b/Makefile index e1f2ed7e..fc211437 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ test: install .PHONY: lint lint: #! Run type analysis and linting checks lint: install - @poetry run mypy ldclient testing + @poetry run mypy ldclient # # Documentation generation diff --git a/testing/__init__.py b/ldclient/testing/__init__.py similarity index 100% rename from testing/__init__.py rename to ldclient/testing/__init__.py diff --git a/testing/builders.py b/ldclient/testing/builders.py similarity index 100% rename from testing/builders.py rename to ldclient/testing/builders.py diff --git a/testing/feature_store_test_base.py b/ldclient/testing/feature_store_test_base.py similarity index 99% rename from testing/feature_store_test_base.py rename to ldclient/testing/feature_store_test_base.py index ab24f5a2..200a6051 100644 --- a/testing/feature_store_test_base.py +++ b/ldclient/testing/feature_store_test_base.py @@ -1,7 +1,7 @@ from ldclient.interfaces import FeatureStore from ldclient.versioned_data_kind import FEATURES -from testing.builders import * +from ldclient.testing.builders import * from abc import abstractmethod import pytest @@ -21,11 +21,11 @@ def create_feature_store(self) -> FeatureStore: class StoreTestScope: def __init__(self, store: FeatureStore): self.__store = store - + @property def store(self) -> FeatureStore: return self.__store - + # These magic methods allow the scope to be automatically cleaned up in a "with" block def __enter__(self): return self.__store @@ -59,7 +59,7 @@ def inited_store(self, tester): } }) return scope - + @staticmethod def make_feature(key, ver): return FlagBuilder(key).version(ver).on(True).variations(True, False).salt('abc').build() diff --git a/testing/http_util.py b/ldclient/testing/http_util.py similarity index 98% rename from testing/http_util.py rename to ldclient/testing/http_util.py index 2b40a0dd..dd3abdf3 100644 --- a/testing/http_util.py +++ b/ldclient/testing/http_util.py @@ -48,7 +48,7 @@ def __init__(self, port, secure): self.server = HTTPServer(('localhost', port), MockServerRequestHandler) if secure: context = SSLContext(PROTOCOL_TLSv1_2) - context.load_cert_chain('./testing/selfsigned.pem', './testing/selfsigned.key') + context.load_cert_chain('./ldclient/testing/selfsigned.pem', './ldclient/testing/selfsigned.key') self.server.socket = context.wrap_socket( self.server.socket, server_side=True diff --git a/testing/impl/__init__.py b/ldclient/testing/impl/__init__.py similarity index 100% rename from testing/impl/__init__.py rename to ldclient/testing/impl/__init__.py diff --git a/testing/impl/datasource/__init__.py b/ldclient/testing/impl/datasource/__init__.py similarity index 100% rename from testing/impl/datasource/__init__.py rename to ldclient/testing/impl/datasource/__init__.py diff --git a/testing/impl/datasource/test_feature_requester.py b/ldclient/testing/impl/datasource/test_feature_requester.py similarity index 97% rename from testing/impl/datasource/test_feature_requester.py rename to ldclient/testing/impl/datasource/test_feature_requester.py index a38a31f6..c10683c6 100644 --- a/testing/impl/datasource/test_feature_requester.py +++ b/ldclient/testing/impl/datasource/test_feature_requester.py @@ -2,8 +2,8 @@ from ldclient.impl.datasource.feature_requester import FeatureRequesterImpl from ldclient.version import VERSION from ldclient.versioned_data_kind import FEATURES, SEGMENTS -from testing.http_util import start_server, BasicResponse, JsonResponse -from testing.proxy_test_util import do_proxy_tests +from ldclient.testing.http_util import start_server, BasicResponse, JsonResponse +from ldclient.testing.proxy_test_util import do_proxy_tests def test_get_all_data_returns_data(): with start_server() as server: diff --git a/testing/impl/datasource/test_polling_processor.py b/ldclient/testing/impl/datasource/test_polling_processor.py similarity index 96% rename from testing/impl/datasource/test_polling_processor.py rename to ldclient/testing/impl/datasource/test_polling_processor.py index bc9dae80..45215afd 100644 --- a/testing/impl/datasource/test_polling_processor.py +++ b/ldclient/testing/impl/datasource/test_polling_processor.py @@ -11,9 +11,9 @@ from ldclient.interfaces import DataSourceStatus, DataSourceState, DataSourceErrorKind from ldclient.versioned_data_kind import FEATURES, SEGMENTS -from testing.builders import * -from testing.stub_util import MockFeatureRequester, MockResponse -from testing.test_util import SpyListener +from ldclient.testing.builders import * +from ldclient.testing.stub_util import MockFeatureRequester, MockResponse +from ldclient.testing.test_util import SpyListener pp = None mock_requester = None diff --git a/testing/impl/datasource/test_streaming.py b/ldclient/testing/impl/datasource/test_streaming.py similarity index 97% rename from testing/impl/datasource/test_streaming.py rename to ldclient/testing/impl/datasource/test_streaming.py index a3cfe60f..4a91c4fd 100644 --- a/testing/impl/datasource/test_streaming.py +++ b/ldclient/testing/impl/datasource/test_streaming.py @@ -13,11 +13,11 @@ from ldclient.interfaces import DataSourceStatus, DataSourceState, DataSourceErrorKind from ldclient.impl.datasource.status import DataSourceUpdateSinkImpl -from testing.builders import * -from testing.http_util import start_server, BasicResponse, CauseNetworkError, SequentialHandler -from testing.proxy_test_util import do_proxy_tests -from testing.stub_util import make_delete_event, make_patch_event, make_put_event, make_invalid_put_event, stream_content -from testing.test_util import SpyListener +from ldclient.testing.builders import * +from ldclient.testing.http_util import start_server, BasicResponse, CauseNetworkError, SequentialHandler +from ldclient.testing.proxy_test_util import do_proxy_tests +from ldclient.testing.stub_util import make_delete_event, make_patch_event, make_put_event, make_invalid_put_event, stream_content +from ldclient.testing.test_util import SpyListener brief_delay = 0.001 diff --git a/testing/impl/evaluator_util.py b/ldclient/testing/impl/evaluator_util.py similarity index 98% rename from testing/impl/evaluator_util.py rename to ldclient/testing/impl/evaluator_util.py index 6715bab9..b0c0e039 100644 --- a/testing/impl/evaluator_util.py +++ b/ldclient/testing/impl/evaluator_util.py @@ -3,7 +3,7 @@ from ldclient.impl.evaluator import Evaluator, _make_big_segment_ref from ldclient.impl.events.types import EventFactory from ldclient.impl.model import * -from testing.builders import * +from ldclient.testing.builders import * from typing import Any, Optional, Tuple, Union diff --git a/testing/impl/events/__init__.py b/ldclient/testing/impl/events/__init__.py similarity index 100% rename from testing/impl/events/__init__.py rename to ldclient/testing/impl/events/__init__.py diff --git a/testing/impl/events/test_diagnostics.py b/ldclient/testing/impl/events/test_diagnostics.py similarity index 100% rename from testing/impl/events/test_diagnostics.py rename to ldclient/testing/impl/events/test_diagnostics.py diff --git a/testing/impl/events/test_event_context_formatter.py b/ldclient/testing/impl/events/test_event_context_formatter.py similarity index 100% rename from testing/impl/events/test_event_context_formatter.py rename to ldclient/testing/impl/events/test_event_context_formatter.py diff --git a/testing/impl/events/test_event_factory.py b/ldclient/testing/impl/events/test_event_factory.py similarity index 98% rename from testing/impl/events/test_event_factory.py rename to ldclient/testing/impl/events/test_event_factory.py index f1e40b2d..b1e4b48e 100644 --- a/testing/impl/events/test_event_factory.py +++ b/ldclient/testing/impl/events/test_event_factory.py @@ -2,7 +2,7 @@ from ldclient.evaluation import EvaluationDetail from ldclient.impl.events.types import EventFactory -from testing.builders import * +from ldclient.testing.builders import * _event_factory_default = EventFactory(False) _user = Context.create('x') diff --git a/testing/impl/events/test_event_processor.py b/ldclient/testing/impl/events/test_event_processor.py similarity index 99% rename from testing/impl/events/test_event_processor.py rename to ldclient/testing/impl/events/test_event_processor.py index 908ca3ee..e8893a52 100644 --- a/testing/impl/events/test_event_processor.py +++ b/ldclient/testing/impl/events/test_event_processor.py @@ -17,9 +17,9 @@ from ldclient.impl.util import timedelta_millis from ldclient.impl.events.event_context_formatter import EventContextFormatter -from testing.builders import * -from testing.proxy_test_util import do_proxy_tests -from testing.stub_util import MockHttp +from ldclient.testing.builders import * +from ldclient.testing.proxy_test_util import do_proxy_tests +from ldclient.testing.stub_util import MockHttp default_config = Config("fake_sdk_key") diff --git a/testing/impl/events/test_event_summarizer.py b/ldclient/testing/impl/events/test_event_summarizer.py similarity index 97% rename from testing/impl/events/test_event_summarizer.py rename to ldclient/testing/impl/events/test_event_summarizer.py index 5f4a76ac..b817d8e5 100644 --- a/testing/impl/events/test_event_summarizer.py +++ b/ldclient/testing/impl/events/test_event_summarizer.py @@ -2,7 +2,7 @@ from ldclient.impl.events.event_summarizer import EventSummarizer, EventSummaryCounter, EventSummaryFlag from ldclient.impl.events.types import * -from testing.builders import * +from ldclient.testing.builders import * user = Context.create('user1') diff --git a/testing/impl/test_attribute_ref.py b/ldclient/testing/impl/test_attribute_ref.py similarity index 100% rename from testing/impl/test_attribute_ref.py rename to ldclient/testing/impl/test_attribute_ref.py diff --git a/testing/impl/test_big_segments.py b/ldclient/testing/impl/test_big_segments.py similarity index 98% rename from testing/impl/test_big_segments.py rename to ldclient/testing/impl/test_big_segments.py index 2b880e4c..501aead1 100644 --- a/testing/impl/test_big_segments.py +++ b/ldclient/testing/impl/test_big_segments.py @@ -2,7 +2,7 @@ from ldclient.evaluation import BigSegmentsStatus from ldclient.impl.big_segments import BigSegmentStoreManager, _hash_for_user_key from ldclient.interfaces import BigSegmentStoreMetadata -from testing.mock_components import MockBigSegmentStore +from ldclient.testing.mock_components import MockBigSegmentStore from queue import Queue import time @@ -108,7 +108,7 @@ def test_membership_query_least_recent_context_evicted_from_cache(): result3 = manager.get_user_membership(user_key_3) assert store.membership_queries == [user_hash_1, user_hash_2, user_hash_3] - + # Since the capacity is only 2 and user_key_1 was the least recently used, that key should be # evicted by the user_key_3 query. Now only user_key_2 and user_key_3 are in the cache, and # querying them again should not cause a new query to the store. @@ -116,12 +116,12 @@ def test_membership_query_least_recent_context_evicted_from_cache(): result3a = manager.get_user_membership(user_key_3) assert result2a == result2 assert result3a == result3 - + assert store.membership_queries == [user_hash_1, user_hash_2, user_hash_3] - + result1a = manager.get_user_membership(user_key_1) assert result1a == result1 - + assert store.membership_queries == [user_hash_1, user_hash_2, user_hash_3, user_hash_1] finally: manager.stop() @@ -130,7 +130,7 @@ def test_status_polling_detects_store_unavailability(): store = MockBigSegmentStore() store.setup_metadata_always_up_to_date() statuses = Queue() - + manager = BigSegmentStoreManager(BigSegmentsConfig(store=store, status_poll_interval=0.01)) try: @@ -155,7 +155,7 @@ def test_status_polling_detects_stale_status(): store = MockBigSegmentStore() store.setup_metadata_always_up_to_date() statuses = Queue() - + manager = BigSegmentStoreManager(BigSegmentsConfig(store=store, status_poll_interval=0.01)) try: diff --git a/testing/impl/test_data_sink.py b/ldclient/testing/impl/test_data_sink.py similarity index 98% rename from testing/impl/test_data_sink.py rename to ldclient/testing/impl/test_data_sink.py index 458dca06..c7b412b2 100644 --- a/testing/impl/test_data_sink.py +++ b/ldclient/testing/impl/test_data_sink.py @@ -9,8 +9,8 @@ from ldclient.impl.listeners import Listeners from ldclient.versioned_data_kind import FEATURES, SEGMENTS -from testing.test_util import SpyListener -from testing.builders import FlagBuilder, FlagRuleBuilder, make_clause, SegmentBuilder, SegmentRuleBuilder +from ldclient.testing.test_util import SpyListener +from ldclient.testing.builders import FlagBuilder, FlagRuleBuilder, make_clause, SegmentBuilder, SegmentRuleBuilder @pytest.fixture diff --git a/testing/impl/test_evaluator.py b/ldclient/testing/impl/test_evaluator.py similarity index 98% rename from testing/impl/test_evaluator.py rename to ldclient/testing/impl/test_evaluator.py index 5e0e8044..279dba71 100644 --- a/testing/impl/test_evaluator.py +++ b/ldclient/testing/impl/test_evaluator.py @@ -1,7 +1,7 @@ from ldclient.client import Context from ldclient.evaluation import EvaluationDetail -from testing.builders import * -from testing.impl.evaluator_util import * +from ldclient.testing.builders import * +from ldclient.testing.impl.evaluator_util import * def test_flag_returns_off_variation_if_flag_is_off(): @@ -100,5 +100,5 @@ def test_segment_match_clause_falls_through_with_no_errors_if_segment_not_found( user = Context.create('foo') flag = make_boolean_flag_with_clauses(make_clause_matching_segment_key('segkey')) evaluator = EvaluatorBuilder().with_unknown_segment('segkey').build() - + assert evaluator.evaluate(flag, user, event_factory).detail.value == False diff --git a/testing/impl/test_evaluator_big_segment.py b/ldclient/testing/impl/test_evaluator_big_segment.py similarity index 97% rename from testing/impl/test_evaluator_big_segment.py rename to ldclient/testing/impl/test_evaluator_big_segment.py index 959728d6..9406b504 100644 --- a/testing/impl/test_evaluator_big_segment.py +++ b/ldclient/testing/impl/test_evaluator_big_segment.py @@ -1,8 +1,8 @@ import pytest from ldclient.evaluation import BigSegmentsStatus -from testing.builders import * -from testing.impl.evaluator_util import * +from ldclient.testing.builders import * +from ldclient.testing.impl.evaluator_util import * def test_big_segment_with_no_generation_is_not_matched(): @@ -30,7 +30,7 @@ def _test_matched_with_include(non_default_kind: bool, multi_kind_context: bool) single_kind_context = Context.create(target_key, 'kind1') if non_default_kind else Context.create(target_key) eval_context = Context.create_multi(single_kind_context, Context.create('key2', 'kind2')) if multi_kind_context \ else single_kind_context - + segment = SegmentBuilder('key').version(1) \ .unbounded(True) \ .unbounded_context_kind('kind1' if non_default_kind else None) \ diff --git a/testing/impl/test_evaluator_bucketing.py b/ldclient/testing/impl/test_evaluator_bucketing.py similarity index 98% rename from testing/impl/test_evaluator_bucketing.py rename to ldclient/testing/impl/test_evaluator_bucketing.py index 767668b5..21182cce 100644 --- a/testing/impl/test_evaluator_bucketing.py +++ b/ldclient/testing/impl/test_evaluator_bucketing.py @@ -2,8 +2,8 @@ from ldclient.impl.evaluator import _bucket_context, _variation_index_for_context from ldclient.impl.model import * -from testing.builders import * -from testing.impl.evaluator_util import * +from ldclient.testing.builders import * +from ldclient.testing.impl.evaluator_util import * import math import pytest @@ -22,7 +22,7 @@ def test_variation_index_is_returned_for_bucket(self): # so we can construct a rollout whose second bucket just barely contains that value bucket_value = math.trunc(_bucket_context(None, user, None, flag.key, flag.salt, None) * 100000) assert bucket_value > 0 and bucket_value < 100000 - + bad_variation_a = 0 matched_variation = 1 bad_variation_b = 2 @@ -44,7 +44,7 @@ def test_last_bucket_is_used_if_bucket_value_equals_total_weight(self): # We'll construct a list of variations that stops right at the target bucket value bucket_value = math.trunc(_bucket_context(None, user, None, flag.key, flag.salt, None) * 100000) - + rule = VariationOrRollout({ 'rollout': { 'variations': [ @@ -54,7 +54,7 @@ def test_last_bucket_is_used_if_bucket_value_equals_total_weight(self): }) result_variation = _variation_index_for_context(flag, rule, user) assert result_variation == (0, False) - + def test_bucket_by_user_key(self): user = Context.create('userKeyA') bucket = _bucket_context(None, user, None, 'hashKey', 'saltyA', None) diff --git a/testing/impl/test_evaluator_clause.py b/ldclient/testing/impl/test_evaluator_clause.py similarity index 97% rename from testing/impl/test_evaluator_clause.py rename to ldclient/testing/impl/test_evaluator_clause.py index 3a74d68e..e716a379 100644 --- a/testing/impl/test_evaluator_clause.py +++ b/ldclient/testing/impl/test_evaluator_clause.py @@ -1,6 +1,6 @@ from ldclient.client import Context -from testing.builders import * -from testing.impl.evaluator_util import * +from ldclient.testing.builders import * +from ldclient.testing.impl.evaluator_util import * def assert_match_clause(clause: dict, context: Context, should_match: bool): diff --git a/testing/impl/test_evaluator_prerequisites.py b/ldclient/testing/impl/test_evaluator_prerequisites.py similarity index 97% rename from testing/impl/test_evaluator_prerequisites.py rename to ldclient/testing/impl/test_evaluator_prerequisites.py index 9f29e538..22b3fd09 100644 --- a/testing/impl/test_evaluator_prerequisites.py +++ b/ldclient/testing/impl/test_evaluator_prerequisites.py @@ -4,8 +4,8 @@ from ldclient.evaluation import EvaluationDetail from ldclient.impl.events.types import EventInputEvaluation -from testing.builders import * -from testing.impl.evaluator_util import * +from ldclient.testing.builders import * +from ldclient.testing.impl.evaluator_util import * def test_flag_returns_off_variation_if_prerequisite_not_found(): diff --git a/testing/impl/test_evaluator_segment.py b/ldclient/testing/impl/test_evaluator_segment.py similarity index 98% rename from testing/impl/test_evaluator_segment.py rename to ldclient/testing/impl/test_evaluator_segment.py index 2dddc34d..d8b555b3 100644 --- a/testing/impl/test_evaluator_segment.py +++ b/ldclient/testing/impl/test_evaluator_segment.py @@ -2,8 +2,8 @@ from ldclient import Context from ldclient.impl.evaluator import _bucket_context -from testing.builders import * -from testing.impl.evaluator_util import * +from ldclient.testing.builders import * +from ldclient.testing.impl.evaluator_util import * def _segment_matches_context(segment: Segment, context: Context) -> bool: diff --git a/testing/impl/test_evaluator_target.py b/ldclient/testing/impl/test_evaluator_target.py similarity index 97% rename from testing/impl/test_evaluator_target.py rename to ldclient/testing/impl/test_evaluator_target.py index c31f7420..840486d0 100644 --- a/testing/impl/test_evaluator_target.py +++ b/ldclient/testing/impl/test_evaluator_target.py @@ -1,6 +1,6 @@ from ldclient.client import Context -from testing.builders import * -from testing.impl.evaluator_util import * +from ldclient.testing.builders import * +from ldclient.testing.impl.evaluator_util import * FALLTHROUGH_VAR = 0 @@ -34,7 +34,7 @@ def test_user_targets_only(self): .target(MATCH_VAR_1, 'c') \ .target(MATCH_VAR_2, 'b', 'a') \ .build() - + expect_match(flag, Context.create('a'), MATCH_VAR_2) expect_match(flag, Context.create('b'), MATCH_VAR_2) expect_match(flag, Context.create('c'), MATCH_VAR_1) @@ -61,7 +61,7 @@ def test_user_targets_and_context_targets(self): .context_target(Context.DEFAULT_KIND, MATCH_VAR_1) \ .context_target(Context.DEFAULT_KIND, MATCH_VAR_2) \ .build() - + expect_match(flag, Context.create('a'), MATCH_VAR_2) expect_match(flag, Context.create('b'), MATCH_VAR_2) expect_match(flag, Context.create('c'), MATCH_VAR_1) diff --git a/testing/impl/test_flag_tracker.py b/ldclient/testing/impl/test_flag_tracker.py similarity index 97% rename from testing/impl/test_flag_tracker.py rename to ldclient/testing/impl/test_flag_tracker.py index bcdaba85..b9f460a4 100644 --- a/testing/impl/test_flag_tracker.py +++ b/ldclient/testing/impl/test_flag_tracker.py @@ -1,5 +1,5 @@ from ldclient.impl.flag_tracker import FlagTrackerImpl -from testing.test_util import SpyListener +from ldclient.testing.test_util import SpyListener from ldclient.impl.listeners import Listeners from ldclient.interfaces import FlagChange diff --git a/testing/impl/test_listeners.py b/ldclient/testing/impl/test_listeners.py similarity index 100% rename from testing/impl/test_listeners.py rename to ldclient/testing/impl/test_listeners.py diff --git a/testing/impl/test_lru_cache.py b/ldclient/testing/impl/test_lru_cache.py similarity index 100% rename from testing/impl/test_lru_cache.py rename to ldclient/testing/impl/test_lru_cache.py diff --git a/testing/impl/test_model_decode.py b/ldclient/testing/impl/test_model_decode.py similarity index 98% rename from testing/impl/test_model_decode.py rename to ldclient/testing/impl/test_model_decode.py index a5e0d44a..c94fb52d 100644 --- a/testing/impl/test_model_decode.py +++ b/ldclient/testing/impl/test_model_decode.py @@ -4,7 +4,7 @@ from ldclient.impl.model import * -from testing.builders import * +from ldclient.testing.builders import * def test_flag_targets_are_stored_as_sets(): diff --git a/testing/impl/test_model_encoder.py b/ldclient/testing/impl/test_model_encoder.py similarity index 100% rename from testing/impl/test_model_encoder.py rename to ldclient/testing/impl/test_model_encoder.py diff --git a/testing/impl/test_operators.py b/ldclient/testing/impl/test_operators.py similarity index 99% rename from testing/impl/test_operators.py rename to ldclient/testing/impl/test_operators.py index 4ed56e79..b7189b24 100644 --- a/testing/impl/test_operators.py +++ b/ldclient/testing/impl/test_operators.py @@ -2,7 +2,7 @@ from ldclient.impl import operators -from testing.builders import * +from ldclient.testing.builders import * @pytest.mark.parametrize("op,context_value,clause_value,expected", [ diff --git a/testing/impl/test_repeating_task.py b/ldclient/testing/impl/test_repeating_task.py similarity index 100% rename from testing/impl/test_repeating_task.py rename to ldclient/testing/impl/test_repeating_task.py diff --git a/testing/impl/test_sampler.py b/ldclient/testing/impl/test_sampler.py similarity index 100% rename from testing/impl/test_sampler.py rename to ldclient/testing/impl/test_sampler.py diff --git a/testing/integrations/__init__.py b/ldclient/testing/integrations/__init__.py similarity index 100% rename from testing/integrations/__init__.py rename to ldclient/testing/integrations/__init__.py diff --git a/testing/integrations/big_segment_store_test_base.py b/ldclient/testing/integrations/big_segment_store_test_base.py similarity index 100% rename from testing/integrations/big_segment_store_test_base.py rename to ldclient/testing/integrations/big_segment_store_test_base.py diff --git a/testing/integrations/persistent_feature_store_test_base.py b/ldclient/testing/integrations/persistent_feature_store_test_base.py similarity index 93% rename from testing/integrations/persistent_feature_store_test_base.py rename to ldclient/testing/integrations/persistent_feature_store_test_base.py index 82dae2da..999c8fae 100644 --- a/testing/integrations/persistent_feature_store_test_base.py +++ b/ldclient/testing/integrations/persistent_feature_store_test_base.py @@ -5,12 +5,12 @@ from ldclient.interfaces import FeatureStore from ldclient.versioned_data_kind import FEATURES -from testing.feature_store_test_base import FeatureStoreTestBase, FeatureStoreTester, StoreTestScope -from testing.test_util import skip_database_tests +from ldclient.testing.feature_store_test_base import FeatureStoreTestBase, FeatureStoreTester, StoreTestScope +from ldclient.testing.test_util import skip_database_tests # The standard test suite to be run against all persistent feature store implementations. See -# testing.feature_store_test_base for the basic model being used here. For each database integration, +# ldclient.testing.feature_store_test_base for the basic model being used here. For each database integration, # we must define a subclass of PersistentFeatureStoreTester which overrides its abstract methods as # appropriate for that database, and then define a subclass of PersistentFeatureStoreTestBase which # simply specifies what tester subclass to use. @@ -29,7 +29,7 @@ def create_persistent_feature_store(self, prefix: str, caching: CacheConfig) -> :param caching: caching parameters for the store constructor """ pass - + @abstractmethod def clear_data(self, prefix: str): """ @@ -74,12 +74,12 @@ def test_stores_with_different_prefixes_are_independent(self): tester_b = self.tester_class() tester_b.prefix = "b" tester_b.clear_data(tester_b.prefix) - + flag_a1 = { 'key': 'flagA1', 'version': 1 } flag_a2 = { 'key': 'flagA2', 'version': 1 } flag_b1 = { 'key': 'flagB1', 'version': 1 } flag_b2 = { 'key': 'flagB2', 'version': 1 } - + with StoreTestScope(tester_a.create_feature_store()) as store_a: with StoreTestScope(tester_b.create_feature_store()) as store_b: store_a.init({ FEATURES: { 'flagA1': flag_a1 } }) diff --git a/testing/integrations/test_consul.py b/ldclient/testing/integrations/test_consul.py similarity index 91% rename from testing/integrations/test_consul.py rename to ldclient/testing/integrations/test_consul.py index 4292b445..d19b594e 100644 --- a/testing/integrations/test_consul.py +++ b/ldclient/testing/integrations/test_consul.py @@ -1,7 +1,7 @@ from ldclient.integrations import Consul -from testing.integrations.persistent_feature_store_test_base import * -from testing.test_util import skip_database_tests +from ldclient.testing.integrations.persistent_feature_store_test_base import * +from ldclient.testing.test_util import skip_database_tests import pytest have_consul = False diff --git a/testing/integrations/test_dynamodb.py b/ldclient/testing/integrations/test_dynamodb.py similarity index 97% rename from testing/integrations/test_dynamodb.py rename to ldclient/testing/integrations/test_dynamodb.py index e558a8c6..03529045 100644 --- a/testing/integrations/test_dynamodb.py +++ b/ldclient/testing/integrations/test_dynamodb.py @@ -3,9 +3,9 @@ from ldclient.integrations import DynamoDB from ldclient.interfaces import UpdateProcessor -from testing.integrations.big_segment_store_test_base import * -from testing.integrations.persistent_feature_store_test_base import * -from testing.test_util import skip_database_tests +from ldclient.testing.integrations.big_segment_store_test_base import * +from ldclient.testing.integrations.persistent_feature_store_test_base import * +from ldclient.testing.test_util import skip_database_tests import time @@ -50,7 +50,7 @@ class DynamoDBTestHelper: @staticmethod def make_client(): return boto3.client('dynamodb', **DynamoDBTestHelper.options) - + def clear_data_for_prefix(prefix): client = DynamoDBTestHelper.make_client() delete_requests = [] @@ -119,7 +119,7 @@ class DynamoDBFeatureStoreTester(PersistentFeatureStoreTester): def __init__(self): super().__init__() DynamoDBTestHelper.ensure_table_created() - + def create_persistent_feature_store(self, prefix, caching) -> FeatureStore: return DynamoDB.new_feature_store(DynamoDBTestHelper.table_name, prefix=prefix, caching=caching, dynamodb_opts=DynamoDBTestHelper.options) @@ -132,7 +132,7 @@ class DynamoDBBigSegmentTester(BigSegmentStoreTester): def __init__(self): super().__init__() DynamoDBTestHelper.ensure_table_created() - + def create_big_segment_store(self, prefix) -> BigSegmentStore: return DynamoDB.new_big_segment_store(DynamoDBTestHelper.table_name, prefix=prefix, dynamodb_opts=DynamoDBTestHelper.options) diff --git a/testing/integrations/test_redis.py b/ldclient/testing/integrations/test_redis.py similarity index 95% rename from testing/integrations/test_redis.py rename to ldclient/testing/integrations/test_redis.py index 52e571cc..5181752c 100644 --- a/testing/integrations/test_redis.py +++ b/ldclient/testing/integrations/test_redis.py @@ -2,9 +2,9 @@ from ldclient.integrations import Redis from ldclient.versioned_data_kind import FEATURES -from testing.integrations.big_segment_store_test_base import * -from testing.integrations.persistent_feature_store_test_base import * -from testing.test_util import skip_database_tests +from ldclient.testing.integrations.big_segment_store_test_base import * +from ldclient.testing.integrations.persistent_feature_store_test_base import * +from ldclient.testing.test_util import skip_database_tests import pytest import json @@ -55,7 +55,7 @@ def clear_data(self, prefix): class RedisBigSegmentStoreTester(BigSegmentStoreTester): def create_big_segment_store(self, prefix) -> BigSegmentStore: return Redis.new_big_segment_store(prefix=prefix) - + def clear_data(self, prefix): RedisTestHelper.clear_data_for_prefix(prefix or Redis.DEFAULT_PREFIX) diff --git a/testing/integrations/test_test_data_source.py b/ldclient/testing/integrations/test_test_data_source.py similarity index 100% rename from testing/integrations/test_test_data_source.py rename to ldclient/testing/integrations/test_test_data_source.py diff --git a/testing/migrations/__init__.py b/ldclient/testing/migrations/__init__.py similarity index 100% rename from testing/migrations/__init__.py rename to ldclient/testing/migrations/__init__.py diff --git a/testing/migrations/test_migrator.py b/ldclient/testing/migrations/test_migrator.py similarity index 99% rename from testing/migrations/test_migrator.py rename to ldclient/testing/migrations/test_migrator.py index b1822023..67490c7c 100644 --- a/testing/migrations/test_migrator.py +++ b/ldclient/testing/migrations/test_migrator.py @@ -9,8 +9,8 @@ from ldclient.versioned_data_kind import FEATURES from ldclient.impl.events.types import EventInputEvaluation from ldclient.impl.util import timedelta_millis -from testing.builders import FlagBuilder -from testing.test_ldclient import make_client, user +from ldclient.testing.builders import FlagBuilder +from ldclient.testing.test_ldclient import make_client, user from typing import List from time import sleep diff --git a/testing/migrations/test_migrator_builder.py b/ldclient/testing/migrations/test_migrator_builder.py similarity index 100% rename from testing/migrations/test_migrator_builder.py rename to ldclient/testing/migrations/test_migrator_builder.py diff --git a/testing/migrations/test_op_tracker.py b/ldclient/testing/migrations/test_op_tracker.py similarity index 98% rename from testing/migrations/test_op_tracker.py rename to ldclient/testing/migrations/test_op_tracker.py index 7e40ee5f..26adc6be 100644 --- a/testing/migrations/test_op_tracker.py +++ b/ldclient/testing/migrations/test_op_tracker.py @@ -3,8 +3,8 @@ from ldclient import Context from ldclient.migrations import OpTracker, Stage, Operation, Origin, MigrationOpEvent from ldclient.evaluation import EvaluationDetail -from testing.builders import build_off_flag_with_value, MigrationSettingsBuilder -from testing.test_ldclient import user +from ldclient.testing.builders import build_off_flag_with_value, MigrationSettingsBuilder +from ldclient.testing.test_ldclient import user @pytest.fixture diff --git a/testing/mock_components.py b/ldclient/testing/mock_components.py similarity index 100% rename from testing/mock_components.py rename to ldclient/testing/mock_components.py diff --git a/testing/proxy_test_util.py b/ldclient/testing/proxy_test_util.py similarity index 97% rename from testing/proxy_test_util.py rename to ldclient/testing/proxy_test_util.py index 2d6532d4..dab075d9 100644 --- a/testing/proxy_test_util.py +++ b/ldclient/testing/proxy_test_util.py @@ -1,5 +1,5 @@ from ldclient.config import Config, HTTPConfig -from testing.http_util import start_server, BasicResponse, JsonResponse +from ldclient.testing.http_util import start_server, BasicResponse, JsonResponse # Runs tests of all of our supported proxy server configurations: secure or insecure, configured # by Config.http_proxy or by an environment variable, with or without authentication. The action diff --git a/testing/selfsigned.key b/ldclient/testing/selfsigned.key similarity index 100% rename from testing/selfsigned.key rename to ldclient/testing/selfsigned.key diff --git a/testing/selfsigned.pem b/ldclient/testing/selfsigned.pem similarity index 100% rename from testing/selfsigned.pem rename to ldclient/testing/selfsigned.pem diff --git a/testing/stub_util.py b/ldclient/testing/stub_util.py similarity index 98% rename from testing/stub_util.py rename to ldclient/testing/stub_util.py index 2a94d9e8..d947f06e 100644 --- a/testing/stub_util.py +++ b/ldclient/testing/stub_util.py @@ -4,7 +4,7 @@ from ldclient.impl.model import ModelEntity from ldclient.interfaces import EventProcessor, FeatureRequester, FeatureStore, UpdateProcessor -from testing.http_util import ChunkedResponse, JsonResponse +from ldclient.testing.http_util import ChunkedResponse, JsonResponse def item_as_json(item): diff --git a/testing/sync_util.py b/ldclient/testing/sync_util.py similarity index 100% rename from testing/sync_util.py rename to ldclient/testing/sync_util.py diff --git a/testing/test_config.py b/ldclient/testing/test_config.py similarity index 100% rename from testing/test_config.py rename to ldclient/testing/test_config.py diff --git a/testing/test_context.py b/ldclient/testing/test_context.py similarity index 100% rename from testing/test_context.py rename to ldclient/testing/test_context.py diff --git a/testing/test_feature_store_client_wrapper.py b/ldclient/testing/test_feature_store_client_wrapper.py similarity index 100% rename from testing/test_feature_store_client_wrapper.py rename to ldclient/testing/test_feature_store_client_wrapper.py diff --git a/testing/test_feature_store_helpers.py b/ldclient/testing/test_feature_store_helpers.py similarity index 100% rename from testing/test_feature_store_helpers.py rename to ldclient/testing/test_feature_store_helpers.py diff --git a/testing/test_file_data_source.py b/ldclient/testing/test_file_data_source.py similarity index 98% rename from testing/test_file_data_source.py rename to ldclient/testing/test_file_data_source.py index b84e986b..56da7762 100644 --- a/testing/test_file_data_source.py +++ b/ldclient/testing/test_file_data_source.py @@ -16,7 +16,7 @@ from ldclient.interfaces import DataSourceStatus, DataSourceState, DataSourceErrorKind from ldclient.versioned_data_kind import FEATURES, SEGMENTS -from testing.test_util import SpyListener +from ldclient.testing.test_util import SpyListener have_yaml = False try: @@ -295,7 +295,7 @@ def test_does_not_allow_unsafe_yaml(): # This extended syntax defined by pyyaml allows arbitrary code execution. We should be using # yaml.safe_load() which does not support such things. unsafe_yaml = ''' -!!python/object/apply:testing.test_file_data_source.arbitrary_method_called_from_yaml ["hi"] +!!python/object/apply:ldclient.testing.test_file_data_source.arbitrary_method_called_from_yaml ["hi"] ''' path = make_temp_file(unsafe_yaml) try: diff --git a/testing/test_flags_state.py b/ldclient/testing/test_flags_state.py similarity index 100% rename from testing/test_flags_state.py rename to ldclient/testing/test_flags_state.py diff --git a/testing/test_in_memory_feature_store.py b/ldclient/testing/test_in_memory_feature_store.py similarity index 85% rename from testing/test_in_memory_feature_store.py rename to ldclient/testing/test_in_memory_feature_store.py index 72076897..f43dc517 100644 --- a/testing/test_in_memory_feature_store.py +++ b/ldclient/testing/test_in_memory_feature_store.py @@ -3,7 +3,7 @@ from ldclient.feature_store import InMemoryFeatureStore from ldclient.interfaces import FeatureStore -from testing.feature_store_test_base import FeatureStoreTestBase, FeatureStoreTester +from ldclient.testing.feature_store_test_base import FeatureStoreTestBase, FeatureStoreTester def test_in_memory_status_checks(): store = InMemoryFeatureStore() diff --git a/testing/test_init.py b/ldclient/testing/test_init.py similarity index 100% rename from testing/test_init.py rename to ldclient/testing/test_init.py diff --git a/testing/test_ldclient.py b/ldclient/testing/test_ldclient.py similarity index 98% rename from testing/test_ldclient.py rename to ldclient/testing/test_ldclient.py index 9846e805..8ad7c102 100644 --- a/testing/test_ldclient.py +++ b/ldclient/testing/test_ldclient.py @@ -7,8 +7,8 @@ from ldclient.versioned_data_kind import FEATURES, SEGMENTS import pytest -from testing.builders import * -from testing.stub_util import CapturingFeatureStore, MockEventProcessor, MockUpdateProcessor +from ldclient.testing.builders import * +from ldclient.testing.stub_util import CapturingFeatureStore, MockEventProcessor, MockUpdateProcessor unreachable_uri="http://fake" diff --git a/testing/test_ldclient_end_to_end.py b/ldclient/testing/test_ldclient_end_to_end.py similarity index 96% rename from testing/test_ldclient_end_to_end.py rename to ldclient/testing/test_ldclient_end_to_end.py index 96d49181..60169497 100644 --- a/testing/test_ldclient_end_to_end.py +++ b/ldclient/testing/test_ldclient_end_to_end.py @@ -1,7 +1,7 @@ from ldclient.client import LDClient, Context from ldclient.config import Config, HTTPConfig -from testing.http_util import BasicResponse, SequentialHandler, start_secure_server, start_server -from testing.stub_util import make_put_event, poll_content, stream_content +from ldclient.testing.http_util import BasicResponse, SequentialHandler, start_secure_server, start_server +from ldclient.testing.stub_util import make_put_event, poll_content, stream_content import json import pytest @@ -148,7 +148,7 @@ def test_can_connect_with_selfsigned_cert_by_setting_ca_certs(): base_uri = server.uri, stream = False, send_events = False, - http = HTTPConfig(ca_certs = './testing/selfsigned.pem') + http = HTTPConfig(ca_certs = './ldclient/testing/selfsigned.pem') ) with LDClient(config = config) as client: assert client.is_initialized() diff --git a/testing/test_ldclient_evaluation.py b/ldclient/testing/test_ldclient_evaluation.py similarity index 98% rename from testing/test_ldclient_evaluation.py rename to ldclient/testing/test_ldclient_evaluation.py index 02ecd0a9..04fcf97a 100644 --- a/testing/test_ldclient_evaluation.py +++ b/ldclient/testing/test_ldclient_evaluation.py @@ -8,10 +8,10 @@ from ldclient.interfaces import FeatureStore from ldclient.versioned_data_kind import FEATURES, SEGMENTS -from testing.builders import * -from testing.mock_components import MockBigSegmentStore -from testing.stub_util import MockEventProcessor, MockUpdateProcessor -from testing.test_ldclient import make_client, user +from ldclient.testing.builders import * +from ldclient.testing.mock_components import MockBigSegmentStore +from ldclient.testing.stub_util import MockEventProcessor, MockUpdateProcessor +from ldclient.testing.test_ldclient import make_client, user flag1 = { diff --git a/testing/test_ldclient_events.py b/ldclient/testing/test_ldclient_events.py similarity index 97% rename from testing/test_ldclient_events.py rename to ldclient/testing/test_ldclient_events.py index 48568737..28115747 100644 --- a/testing/test_ldclient_events.py +++ b/ldclient/testing/test_ldclient_events.py @@ -8,9 +8,9 @@ from ldclient.versioned_data_kind import FEATURES from ldclient.migrations import OpTracker, Stage, Operation, Origin -from testing.builders import * -from testing.stub_util import MockUpdateProcessor -from testing.test_ldclient import context, make_client, make_ldd_client, make_offline_client, unreachable_uri, user +from ldclient.testing.builders import * +from ldclient.testing.stub_util import MockUpdateProcessor +from ldclient.testing.test_ldclient import context, make_client, make_ldd_client, make_offline_client, unreachable_uri, user def get_first_event(c): diff --git a/testing/test_ldclient_listeners.py b/ldclient/testing/test_ldclient_listeners.py similarity index 91% rename from testing/test_ldclient_listeners.py rename to ldclient/testing/test_ldclient_listeners.py index 2a7798b7..ba4c4d7a 100644 --- a/testing/test_ldclient_listeners.py +++ b/ldclient/testing/test_ldclient_listeners.py @@ -1,9 +1,9 @@ from ldclient.client import LDClient, Config from ldclient.interfaces import DataSourceState from ldclient.config import BigSegmentsConfig -from testing.mock_components import MockBigSegmentStore -from testing.stub_util import MockEventProcessor, MockUpdateProcessor, make_put_event, stream_content -from testing.http_util import start_server +from ldclient.testing.mock_components import MockBigSegmentStore +from ldclient.testing.stub_util import MockEventProcessor, MockUpdateProcessor, make_put_event, stream_content +from ldclient.testing.http_util import start_server from queue import Queue diff --git a/testing/test_ldclient_migration_variation.py b/ldclient/testing/test_ldclient_migration_variation.py similarity index 95% rename from testing/test_ldclient_migration_variation.py rename to ldclient/testing/test_ldclient_migration_variation.py index 81d1c811..4adc1aa9 100644 --- a/testing/test_ldclient_migration_variation.py +++ b/ldclient/testing/test_ldclient_migration_variation.py @@ -3,8 +3,8 @@ from ldclient.versioned_data_kind import FEATURES from ldclient.migrations import Stage, Operation, Origin -from testing.builders import FlagBuilder -from testing.test_ldclient import make_client, user +from ldclient.testing.builders import FlagBuilder +from ldclient.testing.test_ldclient import make_client, user def test_uses_default_if_flag_not_found(): diff --git a/testing/test_ldclient_singleton.py b/ldclient/testing/test_ldclient_singleton.py similarity index 93% rename from testing/test_ldclient_singleton.py rename to ldclient/testing/test_ldclient_singleton.py index f685ea1b..5c049fef 100644 --- a/testing/test_ldclient_singleton.py +++ b/ldclient/testing/test_ldclient_singleton.py @@ -1,9 +1,9 @@ import ldclient from ldclient import _reset_client from ldclient.config import Config -from testing.http_util import start_server, BasicResponse -from testing.stub_util import make_put_event, stream_content -from testing.sync_util import wait_until +from ldclient.testing.http_util import start_server, BasicResponse +from ldclient.testing.stub_util import make_put_event, stream_content +from ldclient.testing.sync_util import wait_until import json sdk_key = 'sdk-key' diff --git a/testing/test_util.py b/ldclient/testing/test_util.py similarity index 100% rename from testing/test_util.py rename to ldclient/testing/test_util.py diff --git a/pyproject.toml b/pyproject.toml index 8242bc15..8a4dd102 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,9 +21,9 @@ classifiers = [ "Topic :: Software Development", "Topic :: Software Development :: Libraries", ] -packages = [ - { include = "ldclient" }, - { include = "testing" }, +packages = [ { include = "ldclient" } ] +exclude = [ + { path = "ldclient/testing", format = "wheel" } ] [tool.poetry.dependencies]