diff --git a/functions-python/feed_sync_dispatcher_transitland/tests/test_feed_sync.py b/functions-python/feed_sync_dispatcher_transitland/tests/test_feed_sync.py index 1baf38547..cd67f70d5 100644 --- a/functions-python/feed_sync_dispatcher_transitland/tests/test_feed_sync.py +++ b/functions-python/feed_sync_dispatcher_transitland/tests/test_feed_sync.py @@ -60,18 +60,16 @@ def test_get_data_rate_limit(mock_get, processor): def test_extract_feeds_data(processor): - feeds_data = { - "feeds": [ - { - "id": "feed1", - "urls": {"static_current": "http://example.com/feed1"}, - "spec": "gtfs", - "onestop_id": "onestop1", - "authorization": {}, - } - ] - } - result = processor.extract_feeds_data(feeds_data) + feeds_data = [ + { + "id": "feed1", + "urls": {"static_current": "http://example.com"}, + "spec": "gtfs", + "onestop_id": "onestop1", + "authorization": {}, + } + ] + result = processor.extract_feeds_data(feeds_data, []) assert len(result) == 1 assert result[0]["feed_id"] == "feed1" diff --git a/functions-python/feed_sync_process_transitland/src/main.py b/functions-python/feed_sync_process_transitland/src/main.py index 50160e105..f4de7e1e8 100644 --- a/functions-python/feed_sync_process_transitland/src/main.py +++ b/functions-python/feed_sync_process_transitland/src/main.py @@ -28,7 +28,7 @@ from helpers.database import start_db_session, configure_polymorphic_mappers from helpers.feed_sync.models import TransitFeedSyncPayload as FeedPayload from helpers.logger import Logger -from .feed_processor_utils import check_url_status, create_new_feed +from feed_processor_utils import check_url_status, create_new_feed # Environment variables PROJECT_ID = os.getenv("PROJECT_ID") diff --git a/functions-python/feed_sync_process_transitland/tests/test_feed_processor_utils.py b/functions-python/feed_sync_process_transitland/tests/test_feed_processor_utils.py index 2d1a87733..096cb3627 100644 --- a/functions-python/feed_sync_process_transitland/tests/test_feed_processor_utils.py +++ b/functions-python/feed_sync_process_transitland/tests/test_feed_processor_utils.py @@ -3,7 +3,7 @@ import requests from database_gen.sqlacodegen_models import Gtfsfeed, Gtfsrealtimefeed -from feed_sync_process_transitland.src.feed_processor_utils import ( +from feed_processor_utils import ( check_url_status, get_feed_model, get_tlnd_authentication_type, diff --git a/functions-python/feed_sync_process_transitland/tests/test_feed_sync_process.py b/functions-python/feed_sync_process_transitland/tests/test_feed_sync_process.py index 67382ea1c..ebff8b14c 100644 --- a/functions-python/feed_sync_process_transitland/tests/test_feed_sync_process.py +++ b/functions-python/feed_sync_process_transitland/tests/test_feed_sync_process.py @@ -326,7 +326,7 @@ def test_process_feed_event_invalid_json(self, mock_logging): # Verify error handling mock_logging.error.assert_called() - @patch("feed_sync_process_transitland.src.main.create_new_feed") + @patch("main.create_new_feed") def test_process_new_feed_or_skip( self, create_new_feed_mock, processor, feed_payload, mock_logging ): @@ -337,7 +337,7 @@ def test_process_new_feed_or_skip( processor._process_new_feed_or_skip(feed_payload) create_new_feed_mock.assert_called_once() - @patch("feed_sync_process_transitland.src.main.create_new_feed") + @patch("main.create_new_feed") def test_process_new_feed_skip( self, create_new_feed_mock, processor, feed_payload, mock_logging ): @@ -348,7 +348,7 @@ def test_process_new_feed_skip( processor._process_new_feed_or_skip(feed_payload) create_new_feed_mock.assert_not_called() - @patch("feed_sync_process_transitland.src.main.create_new_feed") + @patch("main.create_new_feed") def test_process_existing_feed_refs( self, create_new_feed_mock, processor, feed_payload, mock_logging ): @@ -399,7 +399,7 @@ def test_process_existing_feed_refs( _ = processor._process_existing_feed_refs(feed_payload, matching_feeds) create_new_feed_mock.assert_called_once() - @patch("feed_sync_process_transitland.src.main.create_new_feed") + @patch("main.create_new_feed") def test_update_feed(self, create_new_feed_mock, processor, feed_payload): """Test updating an existing feed.""" # No matching feed diff --git a/functions-python/helpers/tests/test_transform.py b/functions-python/helpers/tests/test_transform.py index 5ce65d4d8..4fb81711c 100644 --- a/functions-python/helpers/tests/test_transform.py +++ b/functions-python/helpers/tests/test_transform.py @@ -1,4 +1,4 @@ -from helpers.transform import to_boolean +from transform import to_boolean def test_to_boolean(): diff --git a/functions-python/operations_api/function_config.json b/functions-python/operations_api/function_config.json index 1af6512ed..874842141 100644 --- a/functions-python/operations_api/function_config.json +++ b/functions-python/operations_api/function_config.json @@ -5,7 +5,8 @@ "timeout": 540, "memory": "1Gi", "trigger_http": true, - "include_folders": ["database_gen", "helpers"], + "include_folders": ["helpers"], + "include_api_folders": ["database_gen"], "environment_variables": [ { "key": "GOOGLE_CLIENT_ID" diff --git a/functions-python/operations_api/tests/feeds_operations/impl/models/test_update_request_gtfs_feed_impl.py b/functions-python/operations_api/tests/feeds_operations/impl/models/test_update_request_gtfs_feed_impl.py index e2a47241d..a5462078d 100644 --- a/functions-python/operations_api/tests/feeds_operations/impl/models/test_update_request_gtfs_feed_impl.py +++ b/functions-python/operations_api/tests/feeds_operations/impl/models/test_update_request_gtfs_feed_impl.py @@ -4,11 +4,11 @@ from feeds_operations_gen.models.feed_status import FeedStatus from feeds_operations_gen.models.source_info import SourceInfo from feeds_operations_gen.models.update_request_gtfs_feed import UpdateRequestGtfsFeed -from operations_api.src.feeds_operations.impl.models.update_request_gtfs_feed_impl import ( +from feeds_operations.impl.models.update_request_gtfs_feed_impl import ( UpdateRequestGtfsFeedImpl, ) -from operations_api.src.feeds_operations.impl.models.redirect_impl import RedirectImpl -from operations_api.src.feeds_operations.impl.models.external_id_impl import ( +from feeds_operations.impl.models.redirect_impl import RedirectImpl +from feeds_operations.impl.models.external_id_impl import ( ExternalIdImpl, ) diff --git a/functions-python/operations_api/tests/feeds_operations/impl/models/test_update_request_gtfs_rt_feed_impl.py b/functions-python/operations_api/tests/feeds_operations/impl/models/test_update_request_gtfs_rt_feed_impl.py index 6d80f3743..591f6c9e6 100644 --- a/functions-python/operations_api/tests/feeds_operations/impl/models/test_update_request_gtfs_rt_feed_impl.py +++ b/functions-python/operations_api/tests/feeds_operations/impl/models/test_update_request_gtfs_rt_feed_impl.py @@ -16,8 +16,8 @@ from feeds_operations_gen.models.update_request_gtfs_rt_feed import ( UpdateRequestGtfsRtFeed, ) -from operations_api.src.feeds_operations.impl.models.redirect_impl import RedirectImpl -from operations_api.src.feeds_operations.impl.models.external_id_impl import ( +from feeds_operations.impl.models.redirect_impl import RedirectImpl +from feeds_operations.impl.models.external_id_impl import ( ExternalIdImpl, ) diff --git a/functions-python/operations_api/tests/feeds_operations/impl/test_feeds_operations_impl_gtfs.py b/functions-python/operations_api/tests/feeds_operations/impl/test_feeds_operations_impl_gtfs.py index 75fe0b2ed..cbdd96dea 100644 --- a/functions-python/operations_api/tests/feeds_operations/impl/test_feeds_operations_impl_gtfs.py +++ b/functions-python/operations_api/tests/feeds_operations/impl/test_feeds_operations_impl_gtfs.py @@ -13,7 +13,7 @@ from feeds_operations_gen.models.feed_status import FeedStatus from feeds_operations_gen.models.source_info import SourceInfo from feeds_operations_gen.models.update_request_gtfs_feed import UpdateRequestGtfsFeed -from operations_api.tests.conftest import feed_mdb_40 +from conftest import feed_mdb_40 from test_utils.database_utils import get_testing_session, default_db_url diff --git a/functions-python/operations_api/tests/feeds_operations/impl/test_feeds_operations_impl_gtfs_rt.py b/functions-python/operations_api/tests/feeds_operations/impl/test_feeds_operations_impl_gtfs_rt.py index d07fd9987..785a22fe7 100644 --- a/functions-python/operations_api/tests/feeds_operations/impl/test_feeds_operations_impl_gtfs_rt.py +++ b/functions-python/operations_api/tests/feeds_operations/impl/test_feeds_operations_impl_gtfs_rt.py @@ -14,7 +14,7 @@ from feeds_operations_gen.models.update_request_gtfs_rt_feed import ( UpdateRequestGtfsRtFeed, ) -from operations_api.tests.conftest import feed_mdb_41 +from conftest import feed_mdb_41 from test_utils.database_utils import get_testing_session, default_db_url diff --git a/scripts/api-tests.sh b/scripts/api-tests.sh index 0294781bc..5c63a2343 100755 --- a/scripts/api-tests.sh +++ b/scripts/api-tests.sh @@ -99,7 +99,7 @@ execute_tests() { venv/bin/python -m pip install --disable-pip-version-check coverage >/dev/null # Run tests with coverage. Add the path to the main file and the shared packages that were linked. - PT="src:src/shared:src/test_shared:$PYTHONPATH" + PT="src:src/shared:src/test_shared:tests:$PYTHONPATH" PYTHONPATH="$PT" venv/bin/coverage run --branch -m pytest -W 'ignore::DeprecationWarning' tests # Fail if tests fail if [ $? -ne 0 ]; then