kubetest
pytest-flask-sqlalchemy
kubetest | pytest-flask-sqlalchemy | |
---|---|---|
2 | 1 | |
203 | 250 | |
0.0% | - | |
0.0 | 0.0 | |
over 1 year ago | about 1 year ago | |
Python | Python | |
GNU General Public License v3.0 only | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
kubetest
-
Running Tests in a Kubernetes cluster
I was leaning towards python test framework in https://github.com/vapor-ware/kubetest. however, I've since noticed that there have been no contributions to the project for several years.
-
orchestrating contaiers for testing?
- https://github.com/praekeltfoundation/seaworthy but you have to recreate a manifest with code. Not ideal for mildly complex stuff. 3+years was last commit :(( - https://github.com/testcontainers/testcontainers-python which is weirdly specific to certain container images. Again, not working off a manifest (I think), 1 months since last commit. :( - https://github.com/vapor-ware/kubetest which uses kubernetes(k8s) manifests and integrates with pyTest. Last commit 10 month ago.
pytest-flask-sqlalchemy
-
Pytest database not creating tables
import flask import pytest import responses import werkzeug from myproject.app import create_app from myproject.ext import db class TestClient(flask.testing.FlaskClient): def __init__(self, *args, user=None, auth_token=None, **kwargs): self.user = user self.auth_token = auth_token super().__init__(*args, **kwargs) def open(self, *args, **kwargs): headers = kwargs.pop("headers", werkzeug.datastructures.Headers()) headers.extend({"Authorization": f"Bearer {self.auth_token}"}) kwargs["headers"] = headers return super().open(*args, **kwargs) test_app = create_app(conf="test") test_app.test_client_class = TestClient @pytest.fixture(scope="session", autouse=True) def app(): with test_app.app_context(): yield test_app @pytest.fixture(scope="session", autouse=True) def _db(app): import myproject.libs.mock_data db.create_all() myproject.libs.mock_data.load_data() yield db db.session.close() db.drop_all() @pytest.fixture(scope="function", autouse=True) def enable_transactional_tests(db_session): """ Ensure every test case is wrapped in a database transaction, that is rollbacked automatically. https://github.com/jeancochrane/pytest-flask-sqlalchemy#enabling-transactions-without-fixtures """ pass @pytest.fixture(scope="function", autouse=True) def create_responses(app): """ Ensure responses is always turned on for all test cases, so that if a test case forgets to mock something, it will be caught, and responses will raise a ConnectionError. """ ENABLE_RESPONSES = app.config["ENABLE_RESPONSES"] if ENABLE_RESPONSES: responses.start() yield responses.stop() responses.reset() else: yield @pytest.fixture(scope="session") def client(app): with app.test_client() as client: yield client
What are some alternatives?
testcontainers-python - Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
pytest-recording - A pytest plugin that allows recording network interactions via VCR.py
seaworthy - Test harness for Docker container images 🌊 🚢
pytest-clarity - A plugin to improve the output of pytest with colourful unified diffs
seaworthy - A CLI to verify Kubernetes resource health
SeleniumBase - 📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
pytest-insta - A practical snapshot testing plugin for pytest.
flask_for_startups - Flask boilerplate using a services oriented structure
pytest-django - A Django plugin for pytest.
pytest-codeblocks - :page_facing_up: Test code blocks in your READMEs
pytest-inline - pytest-inline is a pytest plugin for writing inline tests.