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

Implement a proper testing framework (GSoC23) #1079

Closed
wants to merge 29 commits into from

Conversation

afrid18
Copy link
Contributor

@afrid18 afrid18 commented Jun 26, 2023

Overview

This PR is intended work of Google Summer of Code 2023 Project. This project aims to get rid of binary rpm packages that are being used for testing rpmlint codebase because RPM packages consume relatively more space. Hence mocking them in a way which no longer need Binary RPM packages just for testing purposes.

Description

In this PR, I have mainly worked on PythonCheck tests, which I eventually able to remove 6 binary files after mocking those tests. This approach can be carry forwarded to other checks as well.

afrid18 added 21 commits June 1, 2023 15:00
This is my first pull request on how I have tried to mock a test,
I used FakePkg class and tried to modify an existing test. I have
created a new helper function get_tested_mock_package which helps
to create a FakePkg obj, this object is further passed to tests.
modified to use dict methods in get_tested_mock_package
Test that required FakePkg has been abstracted and hence do not necessarily need to be imported
This commit removes two binary rpm files that were used for testing docs and docs modules in python packages, for which tests are mocking has been implemented
In add_file_with_content function, changes were made to check for any type prior it was only checked for True
created an another test (test_python_dependencies_metadata2) which helps to get rid of a binary file python310-jupyter-server-fileid-0.9.0-7.2.noarch.rpm
In this commit, I have mocked another metadata test, that checks for metadata content in python packages. With this test we can get rid of binary file: python310-scikit-build-0.17.2-41.1.noarch.rpm. The new test function is test_python_dependencies_metadata3
…tatements

In this commit, I have completely removed previous paramatrized tests for 5 binaries, and also added another test test_python_dependencies_metadata4
rpmlint/pkg.py Fixed Show fixed Hide fixed
@afrid18 afrid18 force-pushed the GSoC23 branch 4 times, most recently from 3c34474 to d3d5f18 Compare July 6, 2023 17:58
@afrid18 afrid18 force-pushed the GSoC23 branch 2 times, most recently from 76ff584 to 7d8ab46 Compare July 10, 2023 08:45
Copy link
Member

@danigm danigm left a comment

Choose a reason for hiding this comment

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

Good work, we've starting to have some tests replaced with FakePkg.

.github/workflows/main.yml Outdated Show resolved Hide resolved
rpmlint/pkg.py Outdated Show resolved Hide resolved
rpmlint/pkg.py Outdated Show resolved Hide resolved
test/Testing.py Outdated Show resolved Hide resolved
As this is managed by PR-CI, No need of checking them again on branch
Pkg and FakePkg both use _gather_dep_info and _gather_aux
so moved them to their parent class AbstractPkg
…ested_mock_package

Added a new helper method in FakePkg called create_files
this will avoid if else chain in get_tested_mock_package utility
added a new helper method in FakePkg class which
is  initiate_files_base_data, this is used to initiate
fakepkg class with basic files data after setting
up custom metadata;
removed a binary
other binary is required for  file
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