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

[execute_process] emulate_tty configurable and defaults to true #265

Merged
merged 10 commits into from
Jul 17, 2019

Conversation

stonier
Copy link
Contributor

@stonier stonier commented Jun 22, 2019

Attempting resolution of #188. Can test with the example included.

@wjwwood is this in line with what you were expecting?

@stonier stonier changed the title [execute_process] emulate_tty now configurable and defaults to true [execute_process] emulate_tty configurable and defaults to true Jun 22, 2019
@stonier stonier force-pushed the emulate_tty branch 3 times, most recently from d174fb2 to b9f1dc1 Compare June 23, 2019 04:04
@wjwwood wjwwood self-assigned this Jun 24, 2019
@wjwwood wjwwood added the enhancement New feature or request label Jun 24, 2019
@wjwwood
Copy link
Member

wjwwood commented Jun 24, 2019

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@wjwwood
Copy link
Member

wjwwood commented Jun 24, 2019

@stonier thanks for updating the pr, but it looks like flake8 is complaining still in our CI. :(

@stonier
Copy link
Contributor Author

stonier commented Jun 25, 2019

Your CI looks to be somewhat ahead of my bionic installation which passes the flake 8 test (is it due solely to pytest versions? I have 3.3.2, CI has 4.6.3). I've taken a stab at guessing what the fix should be - can you trigger the CI run?

@clalancette
Copy link
Contributor

I've just rebased this branch, and added some fixes for the flake8 errors; it seems to pass for me locally now. Here's new CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@wjwwood
Copy link
Member

wjwwood commented Jun 25, 2019

Thanks @clalancette and @stonier, yeah I think our CI uses flake8 from pypi (latest).

@wjwwood
Copy link
Member

wjwwood commented Jun 25, 2019

It does appear, however, that a related test is failing on Windows.

@stonier
Copy link
Contributor Author

stonier commented Jun 26, 2019

Just for reference (because that log is a PITA to read):

UnicodeEncodeError: 'charmap' codec can't encode character '\\u2713' in position 154: character maps to <undefined>
....
File "C:\\J\\workspace\\ci_windows\\ws\\src\\ros2\\launch\\launch\\launch\\launch_service.py", line 184, in __process_event
    "processing event: '{}' \u2713 '{}'".format(event, event_handler))

"processing event: '{}' ✓ '{}'".format(event, event_handler))

@wjwwood
Copy link
Member

wjwwood commented Jun 26, 2019

Weird, that's a debug message. Not sure why that would try to print only after these changes... I don't see a failure on master. I wonder if this is a red herring and there's another issue? I'll look into it quickly.

@stonier
Copy link
Contributor Author

stonier commented Jun 29, 2019

Implemented option 2 as discussed in the diff thread (abort emulating tty when passed emulate_tty=True on windows, adjust test expectations for windows with comments, raise an issue).

This closes #188, triggers new issue #268.

@clalancette
Copy link
Contributor

Another CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@stonier
Copy link
Contributor Author

stonier commented Jul 7, 2019

Pushed a commit for the linting. Worth noting though, it's something of a challenge getting the linting to work in the same way as it does on CI - I haven't been able to do so yet. Without going into the CI console log to try and reproduce the environment setup step-by-step are there more convenient instructions somewhere?

It's worth noting that on a dashing-bionic install:

  • System dependencies defined by ament_cmake_flake8 do not create the same environment as the CI tests (e.g. does not even bring in python3-flake8-docstrings)
  • If someone does happen to have python3-flake8-docstrings installed on their system, the tests fail in a multitude of ways (different version, different configuration?)

Does it really need to lean on non-system versions?

@wjwwood
Copy link
Member

wjwwood commented Jul 8, 2019

are there more convenient instructions somewhere?

This part of the setup instructions have you install flake8-docstrings and some other things, from pip:

https://index.ros.org/doc/ros2/Installation/Dashing/Linux-Development-Setup/#install-development-tools-and-ros-tools

Which is what our CI does.

Our binary instructions exclude things needed to run tests, because the assumption is that if you're installing the binaries that you are building on top of it and will install your own test dependencies if you want to run linters on your packages. We also build from source when drafting changes to the core packages, since that is more likely to be up-to-date than the binary packages and because that's what we need to do in order to emulate CI's checks.

You could also use our docker images if you want a known good environment in which to test.

Sorry you had issues getting the linters to behave, that can be frustrating.

System dependencies defined by ament_cmake_flake8 do not create the same environment as the CI tests (e.g. does not even bring in python3-flake8-docstrings)

That's because we install it from pip and debian packages cannot install dependencies from pip.

If someone does happen to have python3-flake8-docstrings installed on their system, the tests fail in a multitude of ways (different version, different configuration?)

That's correct, it's an out of date version with bugs/false positives in it.

Does it really need to lean on non-system versions?

Unfortunately, yes I believe it does. You could argue that we don't need all of these linter extensions in the first place, which I would tend to agree with a bit (thought obviously others on the team thought they were worthwhile), but if you really want to push against this, I'd try to find the point where these linters were added and comment there.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

One question, otherwise lgtm.

launch/launch/actions/execute_process.py Outdated Show resolved Hide resolved
@stonier
Copy link
Contributor Author

stonier commented Jul 8, 2019

Does it really need to lean on non-system versions?

Unfortunately, yes I believe it does. You could argue that we don't need all of these linter extensions in the first place, which I would tend to agree with a bit (thought obviously others on the team thought they were worthwhile), but if you really want to push against this, I'd try to find the point where these linters were added and comment there.

It's not a big drama, but it does certainly complicate things and the ROS infrastructure promises that one has come to rely on start to fall away.

The implication here is that I can install ament debian packages for linting, but they have only been verified to work with hidden pip dependencies. There is no guarantee that they will even be functional out of the box without their pip dependencies.

Additionally, the test_depends elements in package.xml are no longer a true representation and subsequently a rosdep install will no longer get everything you need to build and run your tests.

Thanks for the link back to the installation docs though.

@wjwwood
Copy link
Member

wjwwood commented Jul 8, 2019

There is no guarantee that they will even be functional out of the box without their pip dependencies.

I agree, though I also see the counter point of how constraining it is when we cannot use the tools we need to get the job done (not saying that's the case here, but it has been in similar cases in the past).

Perhaps @dirk-thomas can comment on this, since he spends a lot of time working on these tools and dependencies. (he's on vacation right now though, so it might be later)

Additionally, the test_depends elements in package.xml are no longer a true representation and subsequently a rosdep install will no longer get everything you need to build and run your tests.

rosdep will still work, since we map the rosdep key's in the package.xml to pip not to apt in these cases. The only thing that does not work is that apt packages cannot not automatically install them. This has come up over and over again in ROS 1, e.g.: ros/catkin#746

Copy link
Member

@wjwwood wjwwood 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!

@wjwwood
Copy link
Member

wjwwood commented Jul 16, 2019

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Edit: needed to recreate the repos file since we pinned the fastrtps version yesterday.

stonier and others added 10 commits July 17, 2019 11:46
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
…mended in review

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
@wjwwood
Copy link
Member

wjwwood commented Jul 17, 2019

I had to rebase this because of how our CI works, but here's a new round:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@wjwwood wjwwood merged commit 561a23a into ros2:master Jul 17, 2019
@wjwwood
Copy link
Member

wjwwood commented Jul 17, 2019

Thanks @stonier for the contribution and for taking time to iterate with us!

@wjwwood
Copy link
Member

wjwwood commented Jul 18, 2019

Unfortunately this broke a bunch of our tests last night, so I'll revert and fix it up.

@dirk-thomas
Copy link
Member

Unfortunately this broke a bunch of our tests last night, so I'll revert and fix it up.

Just for the record: the tests failing to match their output seem to be related to this change http://build.ros2.org/view/Eci/job/Eci__nightly-fastrtps_ubuntu_bionic_amd64/21/testReport/

wjwwood added a commit that referenced this pull request Jul 18, 2019
wjwwood added a commit that referenced this pull request Jul 24, 2019
wjwwood added a commit that referenced this pull request Jul 24, 2019
…ts to true"" (#277)

* Revert "Revert "[execute_process] emulate_tty configurable and defaults to true (#265)" (#276)"

This reverts commit 15af530.

* add option to strip ansi escape sequences from output in launch_testing

Signed-off-by: William Woodall <william@osrfoundation.org>

* move registration of event handlers before including test file

Signed-off-by: William Woodall <william@osrfoundation.org>

* replace \r\n with \n too, because you get this in emulated tty mode

Signed-off-by: William Woodall <william@osrfoundation.org>

* fix a new test failure due a change in how pytest represents exceptions

See: pytest-dev/pytest#5579

Signed-off-by: William Woodall <william@osrfoundation.org>

* refactor to not use YAML in eval of emulate_tty option

Signed-off-by: William Woodall <william@osrfoundation.org>

* fix typo

Signed-off-by: William Woodall <william@osrfoundation.org>

* refactor emulate_tty tests and test constructor argument

Signed-off-by: William Woodall <william@osrfoundation.org>

* change default for emulate_tty to be False and fix warnings

Signed-off-by: William Woodall <william@osrfoundation.org>
piraka9011 pushed a commit to aws-ros-dev/launch that referenced this pull request Aug 16, 2019
…#265)

* [execute_process] emulate_tty now configurable and defaults to true

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>

* [examples] do not emulate ttys

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>

* trivial

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>

* test for emulate_tty configuration

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>

* copyright

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>

* attempted flake8 fixes

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>

* Fix flake8 errors.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

* guard for windows (#1)

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>

* linting, fix quotes on strings

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>

* drop the warning and guard, lean on the graceful degradation as recommended in review

Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
piraka9011 pushed a commit to aws-ros-dev/launch that referenced this pull request Aug 16, 2019
piraka9011 pushed a commit to aws-ros-dev/launch that referenced this pull request Aug 16, 2019
…ts to true"" (ros2#277)

* Revert "Revert "[execute_process] emulate_tty configurable and defaults to true (ros2#265)" (ros2#276)"

This reverts commit 15af530.

* add option to strip ansi escape sequences from output in launch_testing

Signed-off-by: William Woodall <william@osrfoundation.org>

* move registration of event handlers before including test file

Signed-off-by: William Woodall <william@osrfoundation.org>

* replace \r\n with \n too, because you get this in emulated tty mode

Signed-off-by: William Woodall <william@osrfoundation.org>

* fix a new test failure due a change in how pytest represents exceptions

See: pytest-dev/pytest#5579

Signed-off-by: William Woodall <william@osrfoundation.org>

* refactor to not use YAML in eval of emulate_tty option

Signed-off-by: William Woodall <william@osrfoundation.org>

* fix typo

Signed-off-by: William Woodall <william@osrfoundation.org>

* refactor emulate_tty tests and test constructor argument

Signed-off-by: William Woodall <william@osrfoundation.org>

* change default for emulate_tty to be False and fix warnings

Signed-off-by: William Woodall <william@osrfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants