Skip to content

Update to workflows to multi-platform testing, latest python#999

Merged
kroenlein merged 4 commits intomainfrom
maintain/update-testing-workflow
Sep 12, 2025
Merged

Update to workflows to multi-platform testing, latest python#999
kroenlein merged 4 commits intomainfrom
maintain/update-testing-workflow

Conversation

@kroenlein
Copy link
Copy Markdown
Collaborator

Citrine Python PR

Description

This PR updates the testing protocol to use v1.1 from common-gh-actions. It also adds 3.13 to the test suite and updates the Python classifiers for the repo.

There should be a fast follow removing claimed support for 3.8 and removing that from the testing.

PR Type:

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Maintenance (non-breaking change to assist developers)

Adherence to team decisions

  • I have added tests for 100% coverage
  • I have written Numpy-style docstrings for every method and class.
  • I have communicated the downstream consequences of the PR to others.
  • I have bumped the version in __version__.py

@kroenlein kroenlein requested a review from a team as a code owner September 11, 2025 17:52
Comment thread .github/workflows/pr-tests.yml Fixed
def _mime_type(file_path: Path):
# This string coercion is for supporting pathlib.Path objects in python < 3.8
mime_type = mimetypes.guess_type(str(file_path))[0]
mime_type, _ = mimetypes.guess_type(file_path)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is no longer necessary.

def test_from_path():
"""Test the string representation."""
path = '/some/path/with/file.txt'
path = Path.cwd() / 'some' / 'path' / 'with' / 'file.txt'
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Generates a platform-agnostic absolute path, which is what was necessary for the test.

Comment on lines +43 to +63
@pytest.mark.parametrize(
("filename", "mimetype"),
[
pytest.param(
"asdf.xlsx",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
marks=pytest.mark.xfail(
platform.system() == "Windows",
reason="windows-latest test servers omit xlsx from their registry",
strict=True
)
),
("asdf.xls", "application/vnd.ms-excel"),
("asdf.XLS", "application/vnd.ms-excel"),
("asdf.TXT", "text/plain"),
("asdf.csv", "text/csv"),
("asdf.FAKE", "application/octet-stream"),
],
)
def test_mime_types(collection: FileCollection, filename, mimetype):
assert collection._mime_type(Path(filename)) == mimetype
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Test now parameterized. The xlsx tests were failing on windows-latest servers because xlsx was not in the build's registry; shouldn't be possible on a Windows box that can open xlsx files.

  • Marked xlsx as strict xfail on Windows, which will alert us if the test server config is updated
  • Moved the case-agnostic check over to xls instead, since that should always hold

Copy link
Copy Markdown
Collaborator

@anoto-moniz anoto-moniz left a comment

Choose a reason for hiding this comment

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

Thanks for the update, Ken!

@kroenlein kroenlein merged commit d088bf8 into main Sep 12, 2025
45 checks passed
@kroenlein kroenlein deleted the maintain/update-testing-workflow branch September 12, 2025 15:47
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