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

Tests: Fix tests.orm.nodes.test_node:test_delete_through_backend #6496

Merged
merged 1 commit into from
Jun 30, 2024

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Jun 29, 2024

Fixes #6436

The test was failing with a core.sqlite_dos storage plugin for the test profile. The problem is that the last assert was checking that the logs for data_two were deleted because data_two itself had been deleted. However, since it was deleted, the ORM instance can no longer be used either, which was causing an exception. Instead, its pk should be recorded before deleting the node, and the final check should just use the pk directly.

It is not quite clear why this test was not failing for the default core.psql_dos storage plugin that is used for tests. It should not be backend specific since both use SQLAlchemy for the ORM.

The test was failing with a `core.sqlite_dos` storage plugin for the
test profile. The problem is that the last assert was checking that the
logs for `data_two` were deleted because `data_two` itself had been
deleted. However, since it was deleted, the ORM instance can no longer
be used either, which was causing an exception. Instead, its pk should
be recorded before deleting the node, and the final check should just
use the pk directly.

It is not quite clear why this test was not failing for the default
`core.psql_dos` storage plugin that is used for tests. It should not be
backend specific since both use SQLAlchemy for the ORM.
Copy link

codecov bot commented Jun 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.79%. Comparing base (ef60b66) to head (3e99afe).
Report is 115 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6496      +/-   ##
==========================================
+ Coverage   77.51%   77.79%   +0.29%     
==========================================
  Files         560      561       +1     
  Lines       41444    41809     +365     
==========================================
+ Hits        32120    32522     +402     
+ Misses       9324     9287      -37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@sphuber sphuber merged commit a44e643 into aiidateam:main Jun 30, 2024
10 checks passed
@sphuber sphuber deleted the fix/6436/node-delete-test branch June 30, 2024 06:38
mikibonacci pushed a commit to mikibonacci/aiida-core that referenced this pull request Sep 3, 2024
…iidateam#6496)

The test was failing with a `core.sqlite_dos` storage plugin for the
test profile. The problem is that the last assert was checking that the
logs for `data_two` were deleted because `data_two` itself had been
deleted. However, since it was deleted, the ORM instance can no longer
be used either, which was causing an exception. Instead, its pk should
be recorded before deleting the node, and the final check should just
use the pk directly.

It is not quite clear why this test was not failing for the default
`core.psql_dos` storage plugin that is used for tests. It should not be
backend specific since both use SQLAlchemy for the ORM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_delete_through_backend fails with SQLite: sqlalchemy.orm.exc.ObjectDeletedError
2 participants