From f9a509912b65094d7e432af3c59af547037994a0 Mon Sep 17 00:00:00 2001 From: Alex Levy Date: Thu, 27 Jul 2023 23:18:54 -0700 Subject: [PATCH 1/2] Fix bug that ignored `lazy=True` on ORM LinkField --- pyairtable/orm/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyairtable/orm/fields.py b/pyairtable/orm/fields.py index a5bc3079..43c6b2f2 100644 --- a/pyairtable/orm/fields.py +++ b/pyairtable/orm/fields.py @@ -552,7 +552,8 @@ def _get_list_value(self, instance: "Model") -> List[T_Linked]: new_records = { record.id: record for record in self.linked_model.from_ids( - cast(List[RecordId], new_record_ids) + cast(List[RecordId], new_record_ids), + fetch=(not self._lazy), ) } # If the list contains record IDs, replace the contents with instances. From eee0140fe15514157b92dbbee42d0aad474cfee2 Mon Sep 17 00:00:00 2001 From: Alex Levy Date: Thu, 27 Jul 2023 23:26:20 -0700 Subject: [PATCH 2/2] Slightly change how often integration tests get run --- Makefile | 8 +++----- README.md | 2 -- tests/integration/conftest.py | 2 +- tox.ini | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index c6a15667..df2cfaa5 100644 --- a/Makefile +++ b/Makefile @@ -24,14 +24,12 @@ release-test: bump: @bash -c "./scripts/bump.sh" -.PHONY: test test-e2e tox coverage lint format docs clean +.PHONY: test test-e2e coverage lint format docs clean test: - tox -e py + tox -- -m 'not integration' test-e2e: - tox -e py -- "" - -tox: test + tox coverage: tox -e coverage diff --git a/README.md b/README.md index 15539488..0bc524f0 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,6 @@ Anyone who uses this library is welcome to [submit a pull request](https://githu 2. New functionality is accompanied by clear, descriptive unit tests. 3. You can run `make test && make docs` successfully. -If you have an enterprise API key that can run end-to-end tests, please also run `env AIRTABLE_API_KEY=... make test-e2e`. - If you want to discuss an idea you're working on but haven't yet finished all of the above, please [open a draft pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests). That will be a clear signal that you're not asking to merge your code (yet) and are just looking for discussion or feedback. Thanks in advance for sharing your ideas! diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 013dd120..8f53a361 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -30,7 +30,7 @@ def api_key(): try: return os.environ["AIRTABLE_API_KEY"] except KeyError: - pytest.skip("integration test requires AIRTABLE_API_KEY env variable") + pytest.skip("integration test requires AIRTABLE_API_KEY") @pytest.fixture diff --git a/tox.ini b/tox.ini index 80863b74..584ae4d0 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ commands = mypy --strict pyairtable tests/test_typing.py passenv = AIRTABLE_API_KEY addopts = -v testpaths = tests -commands = python -m pytest {posargs:-m 'not integration'} +commands = python -m pytest {posargs} deps = -r requirements-test.txt requestsmin: requests==2.22.0 # Keep in sync with setup.cfg