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

Fix tests for Tools, fixes #1214 #1027

Merged
merged 26 commits into from
Apr 8, 2020
Merged

Fix tests for Tools, fixes #1214 #1027

merged 26 commits into from
Apr 8, 2020

Conversation

dneise
Copy link
Member

@dneise dneise commented Mar 22, 2019

Fixes #1025

@dneise
Copy link
Member Author

dneise commented Mar 22, 2019

So first I make sure the test fails.

@codecov
Copy link

codecov bot commented Mar 22, 2019

Codecov Report

Merging #1027 into master will increase coverage by 0.04%.
The diff coverage is 96.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1027      +/-   ##
==========================================
+ Coverage   87.00%   87.04%   +0.04%     
==========================================
  Files         192      192              
  Lines       12185    12192       +7     
==========================================
+ Hits        10601    10612      +11     
+ Misses       1584     1580       -4     
Impacted Files Coverage Δ
ctapipe/core/container.py 74.76% <ø> (ø)
ctapipe/io/eventsource.py 95.23% <ø> (ø)
ctapipe/tools/dump_instrument.py 82.05% <ø> (ø)
ctapipe/tools/muon_reconstruction.py 73.33% <ø> (ø)
ctapipe/core/tool.py 87.91% <78.57%> (+2.10%) ⬆️
ctapipe/calib/camera/tests/test_calibrator.py 100.00% <100.00%> (ø)
ctapipe/calib/camera/tests/test_flatfield.py 92.50% <100.00%> (ø)
ctapipe/calib/camera/tests/test_pedestals.py 100.00% <100.00%> (ø)
ctapipe/containers.py 100.00% <100.00%> (ø)
ctapipe/core/__init__.py 100.00% <100.00%> (ø)
... and 22 more

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 58a7096...b47280a. Read the comment docs.

@dneise dneise requested review from kosack, watsonjj and maxnoe and removed request for kosack March 22, 2019 16:59
@dneise dneise mentioned this pull request Mar 25, 2019
ctapipe/core/tool.py Outdated Show resolved Hide resolved
@kosack
Copy link
Contributor

kosack commented Mar 25, 2019

probably should rename this PR to show that it fixes all tools!

@watsonjj
Copy link
Contributor

Can we also test tool.run(['--help']) for every tool? It can often raise some errors when traitlets have been changed, but not updated in the tool.

@watsonjj watsonjj changed the title Fix reconstruct muons Fix tests for Tools Mar 26, 2019
@watsonjj
Copy link
Contributor

I have created #1034 to test for the help message of tools

watsonjj
watsonjj previously approved these changes Mar 26, 2019
kosack
kosack previously approved these changes Apr 1, 2019
@kosack
Copy link
Contributor

kosack commented Apr 23, 2019

this is mostly ready to merge, but there are a few minor conflicts

@kosack kosack dismissed stale reviews from watsonjj and themself via fee0f61 May 6, 2019 08:20
@kosack kosack self-requested a review May 6, 2019 08:21
@maxnoe maxnoe requested a review from watsonjj March 18, 2020 15:15
@maxnoe maxnoe dismissed their stale review March 18, 2020 15:15

now commiter

@maxnoe
Copy link
Member

maxnoe commented Mar 18, 2020

From the travis log, it seems traitlets applications have an exit method that raises sys.exit which is called by default.

@maxnoe maxnoe force-pushed the fix_reconstruct_muons branch from 3a25998 to 43fbbd4 Compare March 18, 2020 16:24
@maxnoe
Copy link
Member

maxnoe commented Mar 18, 2020

Ok, now I am satisfied with this.

  • A new function run_tools catches the SystemExit and returns the status code

  • A semantic change: the finish method is not called under error conditions anymore.
    The charge extractor used this for writing the file, even e.g. if an exception occured in start.
    I think it is also hioghly surprising, that on error some possibly complex code is started.

@maxnoe
Copy link
Member

maxnoe commented Mar 18, 2020

@kosack codacy complains that I use asserts in unit tests, do we really want to continue using that?

watsonjj
watsonjj previously approved these changes Mar 19, 2020
@kosack
Copy link
Contributor

kosack commented Mar 19, 2020

@kosack codacy complains that I use asserts in unit tests, do we really want to continue using that?

It has a lot of annoying things like that, but it is quite configurable. I just didn't find a good way to ignore unit tests. Basically it just runs prospector and pyflakes. We used to use another system, but it had even worse problems. Until CTAO provides one, let's just stick with it and try to update it's configuration.

https://support.codacy.com/hc/en-us/articles/115002130625-Codacy-Configuration-File

Would be nice to disable only some warnings in tests, however, not all checks.

Though given this: fossasia/query-server#332 it seems they will not fix it. Perhaps there is a better system out there.

@watsonjj
Copy link
Contributor

watsonjj commented Apr 8, 2020

@maxnoe Do you have a moment to fix the conflicts, so we can push to get this merged?

@maxnoe
Copy link
Member

maxnoe commented Apr 8, 2020

Ahyes, sorry I thought this was already merged

@watsonjj watsonjj added this to the v0.8.0 milestone Apr 8, 2020
@maxnoe
Copy link
Member

maxnoe commented Apr 8, 2020

@kosack @watsonjj this should be done now

@kosack kosack merged commit d101013 into master Apr 8, 2020
@maxnoe maxnoe deleted the fix_reconstruct_muons branch July 13, 2020 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some tools are broken
5 participants