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

Provide a generic slugify function in checkbox-support #1511

Open
pieqq opened this issue Sep 27, 2024 · 2 comments
Open

Provide a generic slugify function in checkbox-support #1511

pieqq opened this issue Sep 27, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@pieqq
Copy link
Collaborator

pieqq commented Sep 27, 2024

Enhancement Proposal

Over time, a lot of Checkbox tests have developed their own "slugify" function to deal with naming issues:

  • checkbox-support/checkbox_support/parsers/udevadm.py
  • providers/resource/bin/graphics_card_resource.py
  • providers/resource/bin/snapd_resource.py

While raising #1510, we found out it would be better to have a single slugify function that could be called from everywhere it's required.

This function should be located in checkbox-support/checkbox_support/helpers.

@pieqq pieqq added the enhancement New feature or request label Sep 27, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CHECKBOX-1593.

This message was autogenerated

@pieqq
Copy link
Collaborator Author

pieqq commented Dec 10, 2024

Good to know: Checkbox internals also have its own slugify function:

def slugify(_string):
"""Transform any string to one that can be used in filenames."""
valid_chars = frozenset(
"-_.{}{}".format(string.ascii_letters, string.digits)
)
return "".join(c if c in valid_chars else "_" for c in _string)

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

No branches or pull requests

1 participant