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

Remove force_text usage #211

Closed
wants to merge 1 commit into from
Closed

Conversation

claudep
Copy link
Collaborator

@claudep claudep commented Nov 12, 2021

No description provided.

@claudep
Copy link
Collaborator Author

claudep commented Nov 12, 2021

@asedeno do you have any idea why the tests fails soon with the django settings not configured error? I don't think the change of this patch can cause this error.

Sorry, I unintentionally pushed the commit to master.

@asedeno
Copy link
Collaborator

asedeno commented Nov 13, 2021

@claudep I do not know why, but I'll take a stab at it.

@asedeno
Copy link
Collaborator

asedeno commented Nov 13, 2021

Works with coverage 5.5, breaks with coverage 6.x, which provides an easy workaround for now, but I'd like to not pin coverage long term. Still digging.

@asedeno
Copy link
Collaborator

asedeno commented Nov 13, 2021

As far as I can tell, coverage 6.0+ is importing things early while figuring out what it should be tracing. This causes an early import of haystack which causes an early import of haystack.constants which is full of code that depends on django settings having been initialized, but that has not happed yet because it is too early.

Coverage docs have recently gained a note:

Modules named as sources may be imported twice, once by coverage.py to find their location, then again by your own code or test suite. Usually this isn’t a problem, but could cause trouble if a module has side-effects at import time.

In our .coveragerc file, we have in the sources list, haystack.backends.xapian_backend, which is causing haystack to be imported as per this note.

Our best bet is to pin coverage to 5.5 for now.

@asedeno
Copy link
Collaborator

asedeno commented Nov 13, 2021

Fixed in #213.

@claudep claudep closed this Feb 6, 2022
@claudep claudep deleted the force_text branch February 6, 2022 21:33
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.

None yet

2 participants