Skip to content

Conversation

miketheman
Copy link
Member

The intent of this test is to create a user object, run the validation code, and assert that we get redirected.

With SQLAlchemy 2.0, calling user.id after calling expunge(user) raises Parent instance ... is not bound to a Session; since we manually killed it off.

  • Replace User with UserFactory (saves some manual db calls)
  • Move the token_data assignment prior to expunge
  • Add del user to be really, really sure it's not around

@miketheman miketheman added the testing Test infrastructure and individual tests label Jun 7, 2023
@miketheman miketheman requested a review from a team as a code owner June 7, 2023 22:09
The intent of this test is to create a user object, run the validation
code, and assert that we get redirected.

With SQLAlchemy 2.0, calling `user.id` **after** calling `expunge(user)`
raises `Parent instance ... is not bound to a Session;` since we
manually killed it off.

- Replace User with UserFactory (saves some manual db calls)
- Move the `token_data` assignment prior to expunge
- Add `del user` to be really, really sure it's not around

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman miketheman force-pushed the miketheman/update-test-view branch from d5b1744 to bdb651b Compare June 7, 2023 22:14
@miketheman miketheman enabled auto-merge (squash) June 8, 2023 14:14
@miketheman miketheman merged commit 5960fcc into pypi:main Jun 8, 2023
@miketheman miketheman deleted the miketheman/update-test-view branch June 8, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Test infrastructure and individual tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants