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

Fixes #5761: --test_target flag will redirect to its test file. #6014

Merged
merged 5 commits into from
Dec 22, 2018

Conversation

anubhavsinha98
Copy link
Contributor

@anubhavsinha98 anubhavsinha98 commented Dec 20, 2018

Explanation

Fixes #5761 --test_target flag will redirect to its corresponding backend test file. For ex --test_target='core.domain.feedback_services' will be same as --test_target='core.domain.feedback_services_test' .

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The linter/Karma presubmit checks have passed.
    • These should run automatically, but if not, you can manually trigger them locally using python scripts/pre_commit_linter.py and bash scripts/run_frontend_tests.sh.
  • The PR is made from a branch that's not called "develop".
  • The PR follows the style guide.
  • The PR is assigned to an appropriate reviewer.
    • If you're a new contributor, please ask on Gitter for someone to assign a reviewer.
    • If you're not sure who the appropriate reviewer is, please assign to the issue's "owner" -- see the "talk-to" label on the issue.

@anubhavsinha98
Copy link
Contributor Author

#5761

@codecov-io
Copy link

codecov-io commented Dec 20, 2018

Codecov Report

Merging #6014 into develop will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #6014   +/-   ##
=======================================
  Coverage     45.3%   45.3%           
=======================================
  Files          520     520           
  Lines        30667   30667           
  Branches      4597    4597           
=======================================
  Hits         13893   13893           
  Misses       16774   16774

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a58279...f25ad48. Read the comment docs.

@apb7 apb7 changed the title Fixes:5761 --test_target flag will redirect to its test file. Fixes #5761: --test_target flag will redirect to its test file. Dec 20, 2018
Copy link
Contributor

@apb7 apb7 left a comment

Choose a reason for hiding this comment

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

Hi @anubhavsinha98, ptal!

@@ -240,6 +240,9 @@ def _convert_to_test_target(path):
def main():
"""Run the tests."""
parsed_args = _PARSER.parse_args()
if parsed_args.test_target is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Merge both the if conditions with this condition.

@anubhavsinha98
Copy link
Contributor Author

@apb7 , made the changes. PTAL !

Copy link
Contributor

@lilithxxx lilithxxx left a comment

Choose a reason for hiding this comment

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

You can display a warning message if the user entered the wrong command as it was suggested here. Otherwise looks good. Thanks :)

@anubhavsinha98
Copy link
Contributor Author

@lilithxxx ,can you explain what that wrong command would be as I am not able to recognize?

@lilithxxx
Copy link
Contributor

The one without _test in it would be the wrong command.

@@ -249,7 +249,10 @@ def main():
raise Exception('The delimiter in test_target should be a dot (.)')

if parsed_args.test_target:
all_test_targets = [parsed_args.test_target]
if parsed_args.test_target.endswith('test'):
Copy link
Contributor

Choose a reason for hiding this comment

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

Um can you make it endswith('_test') so as to make it more precise? Thanks

@anubhavsinha98
Copy link
Contributor Author

anubhavsinha98 commented Dec 21, 2018

@lilithxxx, adding the warning message and as @seanlip suggested adding a delay of 3 seconds here also.

@anubhavsinha98
Copy link
Contributor Author

Warning message

@anubhavsinha98
Copy link
Contributor Author

@apb7 , @lilithxxx PTAL !

Copy link
Contributor

@apb7 apb7 left a comment

Choose a reason for hiding this comment

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

@anubhavsinha98, just a couple of minor nits. Thanks!

else:
print ''
print '.....................................................'
print 'WARNING : test_target flag should contain test file.'
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to WARNING : test_target flag should point to the test file.

print '.....................................................'
print ''
time.sleep(3)
print 'Redirecting to its corresponding test file.'
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to Redirecting to its corresponding test file...

@anubhavsinha98
Copy link
Contributor Author

Changes done @apb7 , PTAL !

Copy link
Contributor

@apb7 apb7 left a comment

Choose a reason for hiding this comment

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

Looking all good! @lilithxxx, would you like to review the changes? Thanks!

print ''
print '.....................................................'
print 'WARNING : test_target flag should point to the test file.'
print '.....................................................'
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a confirmation, do we normally use . or -?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm..I think -. Nice catch, @nithusha21! @anubhavsinha98, can you please change this? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea I think we use - @anubhavsinha98 Would you change it please?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops -- sorry @apb7 you already mentioned it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, will change it !
Sorry my fault.

Copy link
Contributor

@lilithxxx lilithxxx left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @anubhavsinha98

Copy link
Contributor

@apb7 apb7 left a comment

Choose a reason for hiding this comment

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

Un-approving till this is resolved. Thanks!

@anubhavsinha98
Copy link
Contributor Author

anubhavsinha98 commented Dec 21, 2018

Yes @apb7 , I am using the same email in Github and CLA.
Actually codician is actually my system name.

Copy link
Contributor

@apb7 apb7 left a comment

Choose a reason for hiding this comment

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

Uh, why this commit?

@anubhavsinha98
Copy link
Contributor Author

Really sorry for that. I tested it if any issue is occuring with my github mail.

@apb7
Copy link
Contributor

apb7 commented Dec 21, 2018

I understand. Please undo the last commit -- in general, do not commit if your PR has been previously approved. Thanks!

@anubhavsinha98
Copy link
Contributor Author

Sorry for unconvinience @apb7 , corrected the commit.

@anubhavsinha98
Copy link
Contributor Author

@apb7 , actually I had not set up mail in the git configurations therefore it was showing codician

Copy link
Contributor

@apb7 apb7 left a comment

Choose a reason for hiding this comment

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

Checked with @anubhavsinha98: He has used the same email for signing the CLA as the one used by GitHub. Thanks!

@apb7 apb7 merged commit 02995f8 into oppia:develop Dec 22, 2018
@rahgurung
Copy link
Contributor

It breaks when I try to run test from a subclass inside a file, like core.controllers.feedback_test.FeedbackThreadPermissionsTests ends up being core.controllers.feedback_test.FeedbackThreadPermissionsTests_test thus test break.
I am here with a solution:
We can count dots (.) in the test target and redirect only if there are two dots, one after core and then after controllers and redirect only for two dots, three dots would be for sub classes thus no redirection.

@rahgurung
Copy link
Contributor

@nithusha21

@anubhavsinha98
Copy link
Contributor Author

Okay, good job @gurungrahul2. Nice catch.

@anubhavsinha98
Copy link
Contributor Author

Actually @gurungrahul2 , I was not aware of the fact that we can test the particular subclass also.
Thanks !

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.

While running back-end tests, module name in test target should redirect to its test class
6 participants