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(test): category_test teardown order fix. #2055

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

akiva10b
Copy link
Contributor

The error occurs during the teardown phase when the test tries to delete categories that reference terms that have already been deleted. Here's the relevant part of the error:

AttributeError: 'NoneType' object has no attribute 'title_group'
sefaria/model/schema.py:220: AttributeError

This suggests that library.get_term(self.sharedTitle) is returning None, and the code attempts to access term.title_group, resulting in an AttributeError.

The root cause is likely that the terms are being deleted before the categories that reference them during teardown. This can happen due to the order in which pytest tears down fixtures, especially when using scope='module' and autouse=True.

Change the scope to 'function' to ensure that it's torn down after create_new_cats.

The error occurs during the teardown phase when the test tries to delete categories that reference terms that have already been deleted. Here's the relevant part of the error:

python
Copy code
E   AttributeError: 'NoneType' object has no attribute 'title_group'

sefaria/model/schema.py:220: AttributeError
This suggests that library.get_term(self.sharedTitle) is returning None, and the code attempts to access term.title_group, resulting in an AttributeError.

The root cause is likely that the terms are being deleted before the categories that reference them during teardown. This can happen due to the order in which pytest tears down fixtures, especially when using scope='module' and autouse=True.

Change the scope to 'function' to ensure that it's torn down after create_new_cats.
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.

1 participant