diff --git a/.github/workflows/test-faststream-examples.yaml b/.github/workflows/test-faststream-examples.yaml new file mode 100644 index 0000000..bb3df83 --- /dev/null +++ b/.github/workflows/test-faststream-examples.yaml @@ -0,0 +1,26 @@ +name: Test faststream gen examples +on: [workflow_dispatch, pull_request, push] + + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install Dependencies and library + shell: bash + run: | + set -ux + python -m pip install --upgrade pip + pip install -e ".[dev]" + - name: Run pytest + shell: bash + run: | + scripts/test.sh + scripts/test.sh docs_src/tutorial/calculate-mean-app/tests/test_application.py + scripts/test.sh docs_src/tutorial/retrieve-publish-crypto/tests/test_application.py + scripts/test.sh docs_src/app_index_example/test.py + diff --git a/faststream_gen/__init__.py b/faststream_gen/__init__.py index 5c796c0..429614a 100644 --- a/faststream_gen/__init__.py +++ b/faststream_gen/__init__.py @@ -1 +1 @@ -__version__ = "0.1.7rc0" \ No newline at end of file +__version__ = "0.1.7rc1" \ No newline at end of file diff --git a/nbs/Helper.ipynb b/nbs/Helper.ipynb index ea8aa06..1c12095 100644 --- a/nbs/Helper.ipynb +++ b/nbs/Helper.ipynb @@ -926,7 +926,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "/tmp/tmp4492dn2w/grand-parent/parent/child/application.py\n", + "/tmp/tmp3i7gtvzn/grand-parent/parent/child/application.py\n", "\n", "\n", "print(\"Hello World\")\n", @@ -995,7 +995,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "/tmp/tmpv8rje5w0/grand-parent/parent/child/application.py\n", + "/tmp/tmpa4z2fli7/grand-parent/parent/child/application.py\n", "\n", "\n", "print(\"Hello World\")\n", @@ -1031,7 +1031,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "\n" + "\n" ] } ], @@ -1205,15 +1205,15 @@ "name": "stdout", "output_type": "stream", "text": [ - "['api', 'kafka', 'getting-started', 'index', 'release', 'nats', 'rabbit']\n" + "['README', 'faststream', '.pre-commit-config', 'CONTRIBUTING', '.github', 'CODE_OF_CONDUCT', 'pyproject', 'docs', 'scripts', 'SECURITY', 'examples', 'LICENSE', 'tests', '.gitignore', '.secrets']\n" ] } ], "source": [ "with download_and_extract_github_repo(FASTSTREAM_REPO_ZIP_URL) as extracted_path:\n", - " files = [p.stem for p in list(Path(extracted_path/FASTSTREAM_ROOT_DIR_NAME/FASTSTREAM_DOCS_DIR_SUFFIX).glob(\"*\"))]\n", + " files = [p.stem for p in list(Path(extracted_path/FASTSTREAM_ROOT_DIR_NAME).glob(\"*\"))]\n", " print(files)\n", - " assert \"index\" in files" + " assert \"pyproject\" in files" ] }, { diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..b14c884 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +minversion = 7.0 +addopts = -ra -q +testpaths = + search/tests \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..09960ab --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +coverage run -m pytest -x --ff "$@" || \ +coverage run -m pytest -x --ff "$@" || \ +coverage run -m pytest -x --ff "$@" diff --git a/docs_src/app_index_example/__init__.py b/search/tests/__init__.py similarity index 100% rename from docs_src/app_index_example/__init__.py rename to search/tests/__init__.py diff --git a/search/tests/examples/__init__.py b/search/tests/examples/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/search/tests/examples/test_example_consume_publish_with_key.py b/search/tests/examples/test_example_consume_publish_with_key.py new file mode 100644 index 0000000..8a48a49 --- /dev/null +++ b/search/tests/examples/test_example_consume_publish_with_key.py @@ -0,0 +1,5 @@ +from search.examples.example_consume_publish_with_key.test_app import ( + test_point_was_incremented, +) + +__all__ = ("test_point_was_incremented",) diff --git a/search/tests/examples/test_example_course_update.py b/search/tests/examples/test_example_course_update.py new file mode 100644 index 0000000..79b37bc --- /dev/null +++ b/search/tests/examples/test_example_course_update.py @@ -0,0 +1,6 @@ +from search.examples.example_course_updates.test_app import ( + test_app_with_new_content, + test_app_without_new_content, +) + +__all__ = ("test_app_with_new_content", "test_app_without_new_content") diff --git a/search/tests/examples/test_example_execute_trade.py b/search/tests/examples/test_example_execute_trade.py new file mode 100644 index 0000000..ce8335d --- /dev/null +++ b/search/tests/examples/test_example_execute_trade.py @@ -0,0 +1,6 @@ +from search.examples.example_execute_trade.test_app import ( + test_app_with_sell_action, + test_app_without_sell_action, +) + +__all__ = ("test_app_without_sell_action", "test_app_with_sell_action") diff --git a/search/tests/examples/test_example_forward_to_another_topic.py b/search/tests/examples/test_example_forward_to_another_topic.py new file mode 100644 index 0000000..1cf65d9 --- /dev/null +++ b/search/tests/examples/test_example_forward_to_another_topic.py @@ -0,0 +1,3 @@ +from search.examples.example_forward_to_another_topic.test_app import test_app + +__all__ = ("test_app",) diff --git a/search/tests/examples/test_example_forward_to_multiple_topics.py b/search/tests/examples/test_example_forward_to_multiple_topics.py new file mode 100644 index 0000000..add9c7f --- /dev/null +++ b/search/tests/examples/test_example_forward_to_multiple_topics.py @@ -0,0 +1,3 @@ +from search.examples.example_forward_to_multiple_topics.test_app import test_app + +__all__ = ("test_app",) diff --git a/search/tests/examples/test_example_infinity_publishing.py b/search/tests/examples/test_example_infinity_publishing.py new file mode 100644 index 0000000..841d13e --- /dev/null +++ b/search/tests/examples/test_example_infinity_publishing.py @@ -0,0 +1,7 @@ +# import pytest + +from search.examples.example_infinity_publishing.test_app import ( + test_message_was_published, +) +__all__ = ("test_message_was_published",) +# pytest.mark.slow(test_message_was_published) diff --git a/search/tests/examples/test_example_investment_updates.py b/search/tests/examples/test_example_investment_updates.py new file mode 100644 index 0000000..5b0b420 --- /dev/null +++ b/search/tests/examples/test_example_investment_updates.py @@ -0,0 +1,9 @@ +from search.examples.example_investment_updates.test_app import ( + test_invest_grater_amount_than_threshold, + test_invest_smaller_amount_than_threshold, +) + +__all__ = ( + "test_invest_smaller_amount_than_threshold", + "test_invest_grater_amount_than_threshold", +) diff --git a/search/tests/examples/test_example_new_employee.py b/search/tests/examples/test_example_new_employee.py new file mode 100644 index 0000000..82fb168 --- /dev/null +++ b/search/tests/examples/test_example_new_employee.py @@ -0,0 +1,3 @@ +from search.examples.example_new_employee.test_app import test_new_employee + +__all__ = ("test_new_employee",) diff --git a/search/tests/examples/test_example_pets.py b/search/tests/examples/test_example_pets.py new file mode 100644 index 0000000..2335d38 --- /dev/null +++ b/search/tests/examples/test_example_pets.py @@ -0,0 +1,3 @@ +from search.examples.example_pets.test_app import test_app + +__all__ = ("test_app",) diff --git a/search/tests/examples/test_example_plants.py b/search/tests/examples/test_example_plants.py new file mode 100644 index 0000000..9eed75b --- /dev/null +++ b/search/tests/examples/test_example_plants.py @@ -0,0 +1,6 @@ +from search.examples.example_plants.test_app import ( + test_sell_plant_is_called, + test_still_growing_is_calles, +) + +__all__ = ("test_sell_plant_is_called", "test_still_growing_is_calles") diff --git a/search/tests/examples/test_example_product_reviews.py b/search/tests/examples/test_example_product_reviews.py new file mode 100644 index 0000000..743d272 --- /dev/null +++ b/search/tests/examples/test_example_product_reviews.py @@ -0,0 +1,9 @@ +from search.examples.example_product_reviews.test_app import ( + test_app_where_review_grade_is_grater_then_5, + test_app_where_review_grade_is_less_then_5, +) + +__all__ = ( + "test_app_where_review_grade_is_grater_then_5", + "test_app_where_review_grade_is_less_then_5", +) diff --git a/search/tests/examples/test_example_publish_with_key.py b/search/tests/examples/test_example_publish_with_key.py new file mode 100644 index 0000000..1cec9a0 --- /dev/null +++ b/search/tests/examples/test_example_publish_with_key.py @@ -0,0 +1,5 @@ +from search.examples.example_publish_with_key.test_app import ( + test_point_was_incremented, +) + +__all__ = ("test_point_was_incremented",) diff --git a/search/tests/examples/test_example_scram256_security.py b/search/tests/examples/test_example_scram256_security.py new file mode 100644 index 0000000..62f5834 --- /dev/null +++ b/search/tests/examples/test_example_scram256_security.py @@ -0,0 +1,3 @@ +from search.examples.example_scram256_security.test_app import test_app + +__all__ = ("test_app",) diff --git a/search/tests/examples/test_example_scram512_security.py b/search/tests/examples/test_example_scram512_security.py new file mode 100644 index 0000000..e7071d3 --- /dev/null +++ b/search/tests/examples/test_example_scram512_security.py @@ -0,0 +1,3 @@ +from search.examples.example_scram512_security.test_app import test_app + +__all__ = ("test_app",) diff --git a/search/tests/examples/test_example_scrape_weather.py b/search/tests/examples/test_example_scrape_weather.py new file mode 100644 index 0000000..d784aae --- /dev/null +++ b/search/tests/examples/test_example_scrape_weather.py @@ -0,0 +1,9 @@ +# import pytest + +from search.examples.example_scrape_weather.test_app import ( + test_message_was_published, +) + +__all__ = ("test_message_was_published",) + +# pytest.mark.slow(test_message_was_published) \ No newline at end of file diff --git a/search/tests/examples/test_example_social_media_post.py b/search/tests/examples/test_example_social_media_post.py new file mode 100644 index 0000000..adbc6a8 --- /dev/null +++ b/search/tests/examples/test_example_social_media_post.py @@ -0,0 +1,6 @@ +from search.examples.example_social_media_post.test_app import ( + test_post_with_just_two_likes, + test_post_with_many_likes, +) + +__all__ = ("test_post_with_just_two_likes", "test_post_with_many_likes") diff --git a/search/tests/examples/test_example_student_query.py b/search/tests/examples/test_example_student_query.py new file mode 100644 index 0000000..78ec3e7 --- /dev/null +++ b/search/tests/examples/test_example_student_query.py @@ -0,0 +1,5 @@ +from search.examples.example_student_query.test_app import ( + test_message_published_to_correct_topic, +) + +__all__ = ("test_message_published_to_correct_topic",) diff --git a/search/tests/examples/test_example_weather_updates.py b/search/tests/examples/test_example_weather_updates.py new file mode 100644 index 0000000..4f703b0 --- /dev/null +++ b/search/tests/examples/test_example_weather_updates.py @@ -0,0 +1,6 @@ +from search.examples.example_weather_updates.test_app import ( + test_not_published_to_weather_alerts, + test_published_to_weather_alerts, +) + +__all__ = ("test_not_published_to_weather_alerts", "test_published_to_weather_alerts") diff --git a/settings.ini b/settings.ini index 9143a10..7b5404d 100644 --- a/settings.ini +++ b/settings.ini @@ -5,7 +5,7 @@ ### Python library ### repo = faststream-gen lib_name = %(repo)s -version = 0.1.7rc0 +version = 0.1.7rc1 min_python = 3.8 license = apache2 black_formatting = False