Skip to content

Make tests independent of optdeps #199

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

Merged
merged 1 commit into from
Jan 29, 2025
Merged

Make tests independent of optdeps #199

merged 1 commit into from
Jan 29, 2025

Conversation

hseg
Copy link
Contributor

@hseg hseg commented Jan 22, 2025

Description

test_content_negotiation_bad_bibtex as currently written will always run, even
if the optional dependency bibtexparser is not installed.

For people using the testsuite to validate their installs who aren't installing
bibtexparser, that makes this unnecessarily annoying (one needs to pass -k 'not test_...' to achieve the same effect).

Instead, this PR makes the test conditional on bibtexparser being installed.

Related Issue

Fixes: #144

@sckott sckott added this to the v2.2 milestone Jan 22, 2025
@sckott
Copy link
Owner

sckott commented Jan 22, 2025

@hseg
Copy link
Contributor Author

hseg commented Jan 22, 2025 via email

@hseg
Copy link
Contributor Author

hseg commented Jan 23, 2025

OK, so a try-except block was illegal there, and pkgutil is deprecated -- this is the solution I found.

@hseg hseg force-pushed the main branch 2 times, most recently from e4b05a1 to 1cb2534 Compare January 23, 2025 12:52
@hseg
Copy link
Contributor Author

hseg commented Jan 23, 2025

(The need to run the test in a chroot in which bibtexparser is not installed makes my feedback loop go through pushing here, this should be the last of the changes. Sorry for the noise.)

@hseg
Copy link
Contributor Author

hseg commented Jan 23, 2025

I just realized that the test I put in is not enough -- it'll make the test fire
on any version of bibtexparser, where we need bibtexparser>=2.0.0b5.

This is a problem since papis requires both habanero and bibtexparser<2,
so I need pytest not to get confused in case bibtexparser is of a too-low
version.

@hseg
Copy link
Contributor Author

hseg commented Jan 23, 2025

Hrmph. The more I think on this, the deeper my concerns go -- this will actually
silence the fact that too-old bibtexparsers will cause the fix to cnrequest to
fail, so that needs fixing as well. Scope is creeping, sorry for dragging this
out.
Oh goody, you already thought of that -- that feature is gated behind
major version 2 -- that's a load of frustration off my chest.

@sckott
Copy link
Owner

sckott commented Jan 23, 2025

Sorry about the lack of tests running each commit - i was on the new "merge experience" UI here, and it wasn't showing the "Approve CI" button. Running now

@sckott
Copy link
Owner

sckott commented Jan 23, 2025

Can you fix @hseg ?

@hseg
Copy link
Contributor Author

hseg commented Jan 24, 2025

Will be afk, possibly until Sunday, but will try to fix after.

@hseg
Copy link
Contributor Author

hseg commented Jan 26, 2025

Found it, forgot a stray paren. That should be it though.

@hseg
Copy link
Contributor Author

hseg commented Jan 27, 2025 via email

In this case: test_content_negotiation_bad_bibtex

Fixes: sckott#144
@sckott sckott merged commit a4546be into sckott:main Jan 29, 2025
8 checks passed
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.

Month returned by habanero.cn.content_negotiation(ids = doi) no longer in curly brackets
2 participants