-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix tests/methods that refer to private functions in Python #7450
Comments
Can I try to do this? |
Sure, which part would you like to do? (each major bullet point is open) |
@kevinlee12 perhaps swap the bullet points with check-boxes? |
good call, done! |
Hi can I take jobs_test.JobManagerUnitTests ? |
sure, go for it! |
@ankita240796 could you please add @kevinlee12 as my reviewer? Thank you |
I'll go ahead and do a review :) |
Hello! I'd like to try: email_manager.BulkEmailsTests |
Hi @KristiKovacs, I've assigned you to |
Hello @DubeySandeep, I'd like to try "suggestion_services_test.SuggestionServicesUnitTests". |
@rahmot, I've assigned you to |
@DubeySandeep, please can you put me through on how to get started with suggestion_services_test.SuggestionServicesUnitTests. Thank you! |
@rahmot I would have approached this issue in the following way: After going through the details of the issue, I understand that "Few test methods in test files are using private methods for testing, so I have to change the test methods such that it only uses the public methods." Let's solve one test method for your case:
With all this information I will go ahead and change the test method and create a PR! (Note: maybe this idea won't work, then you have to take a deeper look and find another way to solve the problem.) I hope this helps. |
@DubeySandeep, thanks for the illumination. I sincerely appreciate. |
Hello @DubeySandeep can I take email_manager.DuplicateEmailTests ? |
@DubeySandeep I have adhered to your instructions and filled the form. |
@Hudda, I've assigned you |
@AnuragVats007 Done. |
Hey @vojtechjelinek Can you please assign me |
@gopivaibhav Done. |
Hey @vojtechjelinek, I was looking into file |
@Mohitbalwani26 They are private because they are not used outside of the build.py file. |
@vojtechjelinek I was thinking to test these functions indirectly. Line 72 in 33ff571
this _minify() can also be tested if we replace _minify() with minify_func() defined in build.py as it internally calls _minify according to some conditions and we can explicitly make sure that it meets the criteria to go through.
similar is case with Line 100 in 33ff571
this test can be merged with test of safe_delete_file() as it internally checks the existence of file by calling _ensure_files_exist() .
Does this approach look good to you? |
@Mohitbalwani26 Sounds good! |
@vojtechjelinek Can you please assign me this file: exp_services_test.ZipFileExportUnitTests (all) |
@ayushjaink8 Sure. |
@vojtechjelinek can you assign me |
@Mohitbalwani26 Done. |
@vojtechjelinek is there any other file i can work on ? if yes, pls assign me to it |
…15020) * fix testing of private method: _minify and _ensure_files_exist * changes as suggested in CR * change filename variable value * change filename variable * fix lint issue
…Tests (#15001) Co-authored-by: Gopi Vaibhav <gopivaibhav@pop-os.localdomain>
@vojtechjelinek Please update the issue description, unassign contributors from tasks they are no longer working on, and remove completed tasks. Add additional task if any arise. Cross check whether the GSoC project clashes with this issue. If so, let @JeeveshGarg know. in order to prevent problems for new contributors. If not, simply respond to this. Thanks. |
@JeeveshGarg Hey, can someone from the dev experience or automated QA overtake this? I no longer focus on this area. |
@oppia/automated-qa-reviewers @U8NWXD @krishnarao22 ? |
@JeeveshGarg I still need to do an audit to update this issue based on the current state of the code base. It'll have to wait until other dev workflow issues like the flakes are under control. I'd recommend removing this as a starter issue for now |
There are currently a few tests that reference private functions in Python. Tests should test through public interface. If the test tests a private method, find a way to test the method through the existing public interface instead (you'll need to find the corresponding public API function that uses the internal private one, and use that function instead in tests). Please note that modifications to other classes outside of the file in question may be necessary.
Note that you can identify such references by searching for the string
# pylint: disable=protected-access
. (If you don't see the string in the file(s) you're assigned to, please let the author of this issue know so that the list can be edited accordingly.)Important: In general, do not just change methods from private to public. You'll need to find the already existing publicly-accessible function which invokes the private method and use that one instead.
The following the cases where we test private functions:
Completed:
The text was updated successfully, but these errors were encountered: