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]: support for non PEP 440 spec versions #493

Merged
merged 7 commits into from
Jan 11, 2024
Merged

[Add]: support for non PEP 440 spec versions #493

merged 7 commits into from
Jan 11, 2024

Conversation

rudra-iitm
Copy link
Contributor

  • Implemented support for versions that do not adhere to the PEP 440 standard. PEP 440 dictates that version numbers should follow the format 'N.N[.N]', whereas the example "debian/20200505dfsg0-2" does not comply with this standard.
  • This pull request addresses the error/warning captured in the attached screenshot.
Screenshot 2024-01-11 at 2 11 44 PM

@sergio-costas
Copy link
Collaborator

And that's why I separated major, minor and revision: because that way, if the version number is like that, we could just use "major" ;-)

@sergio-costas
Copy link
Collaborator

Can you add an unitary test for this, and fix that test error, please?

@rudra-iitm
Copy link
Contributor Author

Can you add an unitary test for this, and fix that test error, please?
@sergio-costas

  • Sure I will add a unitary test for this
  • I am having difficulty identifying the root cause of the test error. The error message indicates "E1101: Module 'pkg_resources.extern' does not have a 'packaging' member (no-member)," but this is incorrect. The 'pkg_resources.extern' module indeed contains the 'packaging' member.

@sergio-costas
Copy link
Collaborator

Mmm... I think that pkg_resources is being deprecated. Maybe that's the problem... (but don't take this for granted, I'm not sure).

@rudra-iitm
Copy link
Contributor Author

@sergio-costas I'm relatively new to open-source development and currently navigating the process of adding a unit test for the aforementioned code. I'm encountering some challenges in this regard. I would appreciate it if you could provide some guidance or ideas on how I can successfully implement the unit test.

@sergio-costas
Copy link
Collaborator

@rudra-iitm Of course. Exactly where are you having trouble?

@sergio-costas
Copy link
Collaborator

I mean... I presume that you know about the unittest module and the basis for adding an unitary test into the unittest.py file...

@rudra-iitm
Copy link
Contributor Author

@sergio-costas
I have a basic understanding of unittest, and my last pull request involved making some minor changes to unittest. However, I'm struggling to come up with a logic for testing the code above.

@sergio-costas
Copy link
Collaborator

I would create an instance of ProcessVersion, and do some calls to _getVersion() passing a %v (and others, like XXXX/%v) as format string, and several version strings with and without that format, to ensure that it detects them correctly.

@rudra-iitm
Copy link
Contributor Author

@sergio-costas, could you kindly review my recent commit that includes tests for version variation and beta releases in the unit tests?

@sergio-costas
Copy link
Collaborator

Looks good, but I thing that it would be a good idea to add other formats not supported. For example, passing as format "debian%V" and as version "1.2.3".

@sergio-costas
Copy link
Collaborator

Thus to check that it doesn't try to parse entries that should be rejected.

@rudra-iitm
Copy link
Contributor Author

@sergio-costas Included tests for version variations and beta releases that are considered invalid.

@sergio-costas
Copy link
Collaborator

Looks good. Thanks!

@sergio-costas sergio-costas merged commit b031776 into ubuntu:stable Jan 11, 2024
1 check passed
@rudra-iitm rudra-iitm deleted the support-debian branch January 11, 2024 15:43
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.

2 participants