-
Notifications
You must be signed in to change notification settings - Fork 38
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
Correctly loading the methods from relatively imported classes #364
Correctly loading the methods from relatively imported classes #364
Conversation
I'll take a look at this. Thanks for raising #360 will use the info to test it locally. |
It seems pretty clear to me that this code needs automated tests or this is going to be broken again at some point. Is there any reason it can't be tested? |
eeef098
to
4161583
Compare
Bumps the pip-dependencies group with 2 updates: [importlib-metadata](https://github.com/python/importlib_metadata) and [setuptools](https://github.com/pypa/setuptools). Updates `importlib-metadata` from 7.1.0 to 7.2.1 - [Release notes](https://github.com/python/importlib_metadata/releases) - [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst) - [Commits](python/importlib_metadata@v7.1.0...v7.2.1) Updates `setuptools` from 70.0.0 to 70.1.0 - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](pypa/setuptools@v70.0.0...v70.1.0) --- updated-dependencies: - dependency-name: importlib-metadata dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pip-dependencies - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pip-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
…tgauge#362) Bumps the pip-dependencies group with 3 updates in the / directory: [debugpy](https://github.com/microsoft/debugpy), [importlib-metadata](https://github.com/python/importlib_metadata) and [setuptools](https://github.com/pypa/setuptools). Updates `debugpy` from 1.8.1 to 1.8.2 - [Release notes](https://github.com/microsoft/debugpy/releases) - [Commits](microsoft/debugpy@v1.8.1...v1.8.2) Updates `importlib-metadata` from 7.2.1 to 8.0.0 - [Release notes](https://github.com/python/importlib_metadata/releases) - [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst) - [Commits](python/importlib_metadata@v7.2.1...v8.0.0) Updates `setuptools` from 70.1.0 to 70.1.1 - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](pypa/setuptools@v70.1.0...v70.1.1) --- updated-dependencies: - dependency-name: debugpy dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pip-dependencies - dependency-name: importlib-metadata dependency-type: direct:production update-type: version-update:semver-major dependency-group: pip-dependencies - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pip-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Signed-off-by: BugDiver <vinayshankar00@gmail.com> Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
…on to getgauge#360) Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Correctly loading the methods from relatively imported classes (getgauge#365) Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com> Co-authored-by: Zabil Cheriya Maliackal <zabil@users.noreply.github.com> Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
f6ef53b
to
bf770bf
Compare
…tps://github.com/kunalvishwasrao/gauge-python into feature/correctly-load-impl-methods-from-classes
Yeah I agree. I am having a tough time testing it locally at the moment because the install scripts are not working as expected and there are some python version issues. @kunalvishwasrao is there a way you can look into some unit tests for this logic? |
Yeah sure @zabil I'll look into unit tests for testing this logic. |
…gauge#365) Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Hey @zabil, I've added a unittest file to test the update_step_resgistry_with_class() method for relative imports of methods inside a class as well as outside as suggested. Can you please review it and let me know if its fine. Thanks!😄 |
tests/test_impl_loader.py
Outdated
os.chdir('tests') | ||
method_list = update_step_resgistry_with_class(Sample(), self.relative_file_path) | ||
os.chdir(curr_dir) | ||
self.assertEqual(2, len(method_list)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.assertEqual(2, len(method_list)) | |
self.assertEqual(["Greet <name> from inside the class", | |
"Greet <name> from outside the class"], | |
[method.step_text for method in method_list])``` | |
Will be good to make this assertion specific |
tests/test_impl_loader.py
Outdated
def test_update_step_resgistry_with_class(self): | ||
curr_dir = os.getcwd() | ||
os.chdir('tests') | ||
method_list = update_step_resgistry_with_class(Sample(), self.relative_file_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method_list = update_step_resgistry_with_class(Sample(), self.relative_file_path) | |
method_list = update_step_registry_with_class(Sample(), self.relative_file_path) |
I understand this is not related to you change but will be a good time to fix the typo in the test and the implementation, if that's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure sure, will do it 😄
Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Hey @zabil, Updated the method name and unttests as suggested. Can you please let me know if it looks fine. Thank!😄 |
@kunalvishwasrao Thank you for contributing to gauge-python. Your pull request has been labeled as a release candidate 🎉🎉. Merging this PR will trigger a release. Please bump up the version as part of this PR.Instructions to bump the version can found at CONTRIBUTING.md If the CONTRIBUTING.md file does not exist or does not include instructions about bumping up the version, please looks previous commits in git history to see what changes need to be done. |
Signed-off-by: Kunal Vishwasrao <kunal.vishwasrao@gmail.com>
Hey @zabil, Thanks for the review and approval!😄 |
After merging #360 all the previous issues were fixed but when I created step implementations inside a class and tried use those steps inside specs, I was getting an error with positional arguments missing.
This issue arises because the
update_step_resgistry_with_class()
method inside theimpl_loader.py
file is unable to fetch all the methods inside that step implementation file insideget_all_methods_in()
method due to thefile_path
being a relative file path.Resolving the relative file path into an absolute file path inside
update_step_resgistry_with_class()
method #365Hey @BugDiver, @zabil, can you please help me merge this PR to resolve this issue.
Apologies for this follow-up PR, missed this update in the previous PR.
Thanks!😄