Skip to content

Only run the msgspec tests if the msgspec library is installed#271

Merged
DanCardin merged 1 commit into
DanCardin:mainfrom
ppentchev:pp-maybe-test-msgspec
Jul 6, 2026
Merged

Only run the msgspec tests if the msgspec library is installed#271
DanCardin merged 1 commit into
DanCardin:mainfrom
ppentchev:pp-maybe-test-msgspec

Conversation

@ppentchev

Copy link
Copy Markdown
Contributor

Hi,

First of all, thanks a lot for writing and maintaining cappa!

What do you think about the following change that will make the test suite run even in weird cases when the msgpack library is not available? As explained in the commit message, this can happen if a packaged version of cappa is built in an environment where the corresponding packaging system does not build the msgspec package at all, even though it may build it for other platforms/architectures.

Thanks in advance for looking into this, and keep up the great work!

G'luck,
Peter

Some packaging systems, e.g. the Debian GNU/Linux one, only build
the msgspec library for a limited set of architectures.
As cappa is packaged in turn, it may happen that a package build may
be triggered on an architecture that does not have a msgspec package
(such as, in the Debian case, i386). Let the test handle that case;
the cappa.class_inspect module will already only import msgspec if
it is actually required.
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.45%. Comparing base (1fd15b5) to head (146da13).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #271   +/-   ##
=======================================
  Coverage   99.45%   99.45%           
=======================================
  Files          28       28           
  Lines        2960     2960           
  Branches      671      671           
=======================================
  Hits         2944     2944           
  Misses         12       12           
  Partials        4        4           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ppentchev

Copy link
Copy Markdown
Contributor Author

...I don't think the typos failed CI job has anything to do with this change :)

@DanCardin DanCardin left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems more than fine! I've already been forced for it to work like this in other places, msgspec just got the short impl i guess.

Thanks for the PR!

@DanCardin
DanCardin merged commit ddb05be into DanCardin:main Jul 6, 2026
10 of 11 checks passed
@ppentchev
ppentchev deleted the pp-maybe-test-msgspec branch July 6, 2026 17:34
@DanCardin

Copy link
Copy Markdown
Owner

Sidebar, do you know offhand what, if anything, this is being packaged because of? Presumably i need to publish a new version for this to be available to whatever that is?

@ppentchev

Copy link
Copy Markdown
Contributor Author

Well, I'm packaging it because I use cappa in a couple of my personal projects, such as media-type-version, uvoxen, or wrap-nix-shell, and I intend to provide at least some of those as Debian packages as time goes by. But the Debian packaging system allows me to add a patch that will be applied during the package build, so no worries for now.

And thanks A LOT for your lightning-fast reaction! :)

@djsigmann

Copy link
Copy Markdown

This may be a bit off-topic, but @DanCardin, how important would you consider running the test suite during packaging is? I'd assume every new release passes all tests (afterall, the CI for it is there).

I'd also like to ask the same question about one of cappa's dependencies, type-lens while I'm at it (that IS your project, right? :D).

Asking because I maintain relevant AUR packages for both cappa and type-lens.

@DanCardin

Copy link
Copy Markdown
Owner

I do maintain type-lens, yes! Both are pure python packages with ci that should always be passing, particularly for released versions.

Practically its probably not that important but you'd know better than me AUR standards. I dont currently, for example, run tests as a prerequisite for the release CI so teeeechnically i could mess something up

@djsigmann

djsigmann commented Jul 11, 2026

Copy link
Copy Markdown

Well, it is encouraged to run checks for Arch and AUR packages, but not a lot of packages actually do so - and those are mostly VCS packages. I only package stable releases for cappa and type-lens, so I doubt it's strictly necessary assuming that all tagged commits pass tests.

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.

3 participants