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

Bug: Port is ignored when specified from extra_args #84

Merged
merged 14 commits into from
Mar 10, 2023

Conversation

Harm10
Copy link
Contributor

@Harm10 Harm10 commented Mar 3, 2023

@robinmatz This is my change for Open connection. To check whether the extra_args contain a port option you need to process them before the Emulator is created. So I copied your updated function from py3270.py and put it logically (it has to return something) in x3270.py.

For this I have several questions and remarks:

  1. I am not sure whether the function in py3270.py can be removed now. The function in x3270.py processes any extra_args (also when a file is specified) and puts them in the format required by Emulator. So the formatting in py3270.py seems to be superfluous now? Or is it used for other purposes too?
  2. The 2 hyphens for the options were also there in the utest elements. So they would not work but nothing went wrong when running the utest previously. I changed the lot any way (atest does correctly specify only 1 hyphen)
  3. If I run inv lint the slice line gets changed from argport = resval[posport+6::].strip() to argport = resval[posport + 6 : : ].strip() and I get a message Mainframe3270/x3270.py:102:53: E203 whitespace before ':' twice. How to circumvent this? I left the code in the original form.

Any other suggestions?

Mainframe3270/x3270.py Outdated Show resolved Hide resolved
Mainframe3270/x3270.py Outdated Show resolved Hide resolved
if posport != -1:
argport = resval[posport+6::].strip()
if argport != "":
self.port = argport
Copy link
Collaborator

@robinmatz robinmatz Mar 4, 2023

Choose a reason for hiding this comment

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

I do not like this implementation. As I suggested in my comment in #80 , if the -port option is specified in extra_args this should be used, but the user should receive some type of hint

logger.warn(
  "The port was specified both from the `port` as well as from the `extra_args` parameter."
  "The one specified in extra_args will be used."
)

I will investigate a way of doing this more elegantly. But this should not prevent you from finding one as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree but how can I discern between a specified port= or set by default through port: int = 23,?

Mainframe3270/x3270.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@robinmatz robinmatz left a comment

Choose a reason for hiding this comment

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

I made some comments to your code.
Generally, I like the thoroughness of this PR. You even went and changed the faulty x3270 command line options in the utests!

However, some additional work is still required:

  • Firstly inv lint caused a failure of the pipeline. Please run this locally and review the errors
  • You can remove the ExecutableApp class and its occurrences in py3270. Let me know if you need help with this.
  • We should find a better way of using the port if it was provided in extra_args, and then give a notification that the port was used from the command line options.

@Harm10
Copy link
Contributor Author

Harm10 commented Mar 4, 2023

@robinmatz You did not respond to my question on the inv lint
"If I run inv lint the slice line gets changed from argport = resval[posport+6::].strip() to argport = resval[posport + 6 : : ].strip() and I get a message Mainframe3270/x3270.py:102:53: E203 whitespace before ':' twice. How to circumvent this? I left the code in the original form."

@robinmatz
Copy link
Collaborator

robinmatz commented Mar 5, 2023

@Harm10 , I created a PR on your fork with my suggested changes. Please see my comments there.

@codecov-commenter
Copy link

codecov-commenter commented Mar 5, 2023

Codecov Report

Patch coverage: 94.91% and project coverage change: +0.86 🎉

Comparison is base (16884a8) 93.45% compared to head (ad01e0f) 94.32%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #84      +/-   ##
==========================================
+ Coverage   93.45%   94.32%   +0.86%     
==========================================
  Files           4        4              
  Lines         581      581              
  Branches       88       90       +2     
==========================================
+ Hits          543      548       +5     
+ Misses         32       28       -4     
+ Partials        6        5       -1     
Flag Coverage Δ
acceptance 80.03% <88.13%> (+4.99%) ⬆️
unit 88.12% <93.22%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Mainframe3270/py3270.py 86.99% <93.54%> (+1.27%) ⬆️
Mainframe3270/x3270.py 99.66% <96.42%> (-0.34%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Harm10
Copy link
Contributor Author

Harm10 commented Mar 5, 2023

I merged your PR. Please see my comments there.

@robinmatz
Copy link
Collaborator

Thanks. There are some parts of the code that I want to optimize still. Also I will write a few more tests to increase the statement coverage.

@robinmatz
Copy link
Collaborator

@Harm10 I started a draft PR on your repo where I will do the remaining changes

@robinmatz
Copy link
Collaborator

@Harm10 - I finished the changes on my PR on your fork. Please review them at any time

@Harm10
Copy link
Contributor Author

Harm10 commented Mar 9, 2023

@robinmatz Whatever I try the connection is no longer build to pub400. Even when only specifying the host there is no connection. Will retry later.

@Harm10
Copy link
Contributor Author

Harm10 commented Mar 9, 2023

@robinmatz I retried with my updated master to also not get any connection. So I guess this is due to PUB400?

@robinmatz robinmatz changed the title Open connection port in args Bug: Port is ignored when specified from extra_args Mar 10, 2023
@Harm10
Copy link
Contributor Author

Harm10 commented Mar 10, 2023

@robinmatz I sent you a remark on RF slack. Are you active on that platform?

I want to know where the logger.warn message should be visible.

@github-actions github-actions bot mentioned this pull request Mar 15, 2023
@Harm10 Harm10 deleted the Open-connection-port-in-args branch March 25, 2023 15:36
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.

3 participants