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

Add automated tests #59

Merged
merged 11 commits into from
Oct 28, 2023
Merged

Add automated tests #59

merged 11 commits into from
Oct 28, 2023

Conversation

JWCook
Copy link
Collaborator

@JWCook JWCook commented Jul 24, 2023

Closes #38

Test setup

  • Added structure for a test suite using the sphinx.testing plugin
    • I added some notes in conftest.py on how the tests are set up, but let me know if any of that doesn't make sense.
    • I think the least obvious part is how input directories are passed to SphinxTestApp (via a pytest fixture and a marker). That's how Sphinx's own tests do it, but it seems potentially confusing.
  • Run tests in CircleCI
  • A test coverage report is generated in the CI job and also output to the console.
    • If you wanted to, you could send this coverage report to Codecov (or a similar site) and enable PR integration
    • You could also add a coverage badge to your readme if you'd like, and show off your shiny new 98% coverage :)

Coverage

Test coverage has been added for:

  • Tags with emoji, spaces, and other special characters
  • Tags in subdirectories
  • Symlinked files and directories
  • Jupyter notebooks
  • Tagged pages (text output of tags directive)
  • Badges
    • Badge colors
  • Sources excluded by exclude_patterns

@JWCook JWCook added the enhancement New feature or request label Jul 24, 2023
@JWCook JWCook force-pushed the tests branch 2 times, most recently from 7e32d2f to 8c9168f Compare August 11, 2023 17:59
@JWCook JWCook changed the title WIP: More tests Add automated tests Aug 11, 2023
@JWCook JWCook marked this pull request as ready for review August 11, 2023 18:06
@JWCook
Copy link
Collaborator Author

JWCook commented Aug 11, 2023

@melissawm I believe this PR is ready to go. This depends on merging #57 first, so once that's done I can rebase this one.

@JWCook
Copy link
Collaborator Author

JWCook commented Oct 27, 2023

I rebased this on top of main, so this is ready to go.

@melissawm
Copy link
Owner

Running pytest on this with Python 3.12, Sphinx 7.2.6, pytest 7.4.3 I get

  /home/melissa/projects/sphinx-tags/test/conftest.py:18: RemovedInSphinx90Warning: 'sphinx.testing.path' is deprecated. Use 'os.path' or 'pathlib' instead.

This is not a blocker though - we could put this in and deal with the deprecation later.

@JWCook
Copy link
Collaborator Author

JWCook commented Oct 27, 2023

Hmm, I originally tried pathlib, but using sphinx.testing.path seemed to be required for Sphinx<=6. You can create another issue for that if you want, and I can look into it some more later.

@melissawm
Copy link
Owner

I'm not going to say I understand all details but I do get the overall idea and I see zero reasons to hold this off - thank you so much for being patient and sticking with it! I have a few more details to sort and should be cutting a release later this weekend. Cheers!

@melissawm melissawm merged commit 2adcc5d into melissawm:main Oct 28, 2023
@JWCook JWCook deleted the tests branch October 28, 2023 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests
2 participants