Skip to content

Commit

Permalink
Merge pull request #284 from mesozoic/fix_itest
Browse files Browse the repository at this point in the history
Fix bug that ignored `lazy=True` on ORM LinkField
  • Loading branch information
mesozoic authored Jul 28, 2023
2 parents 04a93c8 + eee0140 commit 6df1419
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
3 changes: 2 additions & 1 deletion pyairtable/orm/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6df1419

Please sign in to comment.