fortra / impacket

Impacket is a collection of Python classes for working with network protocols.
https://www.coresecurity.com
Other
12.98k stars 3.49k forks source link

Enhancement: Refactor Test Code for Efficiency and Quality #1728

Open freddiewanah opened 3 months ago

freddiewanah commented 3 months ago

Description

As a first-time contributor with a background in researching Python unit tests, I conducted a thorough static analysis of the project's test code. This examination revealed various "test smells" that could potentially degrade both the efficiency and quality of our tests. To address these issues, I've refactored the relevant code segments. The modifications I propose not only aim to eliminate these inefficiencies but are also expected to reduce execution time within GitHub Actions. This reduction could contribute to lower operational costs for the project.

Test smells refactored:

I didn't change any of the testing logic or testing values. The refactoring only focuses on reducing the test smells.

Please feel free to let me know if you are interested in more refactoring like this or if there're any changes that you don't wish.

anadrianmanrique commented 2 months ago

@freddiewanah: Thanks for the amazing work you've done and also for providing such an excellent context explaining the changes! I will start working on improvements in testing by the end of May/first days of June. Validating this PR is my TODO list now. If you are interested in improving the test suit we can discuss which tasks are priority for the next release. Let me know your thoughts ( including which other tasks you see as a priority ). Thanks!!

freddiewanah commented 2 months ago

Hi anadrianmanrique, thanks for prioritizing this PR.

I'm mainly a researcher who works in detecting and refactoring test smells in Python projects. I think two common issues many open-source Python projects are facing are having too many assertions in one test case that will make them mega test cases and not utilizing the decorations provided by testing frameworks. If you are interested in these directions, I could work on this direction and contribute more.