Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug that ignored lazy=True on ORM LinkField #284

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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