Skip to content

Enable doctests for python setup.py test#101

Closed
cdeil wants to merge 1 commit intogammapy:masterfrom
cdeil:doctests
Closed

Enable doctests for python setup.py test#101
cdeil wants to merge 1 commit intogammapy:masterfrom
cdeil:doctests

Conversation

@cdeil
Copy link
Contributor

@cdeil cdeil commented Mar 18, 2014

This is a continuation of #95 ... I didn't realise merging those commits manually into master would close that github issue. Copy of issue description in one of the comments there ...


I fixed most doctests ... what remains to be done is to configure the doctest runner to skip the following files:

  • gammapy/data/poisson_stats_image/fit_sherpa.py
  • gammapy/data/poisson_stats_image/simulate_data.py
  • gammapy/docs/background/estimate_significance_image.py
  • gammapy/docs/tutorials/image/sherpa_fit_image.py
  • docs//image/colormap_example.py

The first four contain imports or non-functioning code and should not be executed.
The last one causes the tests to hang because a matplotlib figure pops up and has to be closed by hand.

I don't know how I can configure the test runner to skip these files entirely?

I currently have this in my setup.cfg:

[pytest]
minversion = 2.2
norecursedirs = build docs/_build
doctest_plus = enabled

I tried putting __doctest_skip__ = ['*'] at the top of these files or adding their filenames norecuredirs list in setup.cfg ... but this doesn't work.

@cdeil cdeil added the tests label Apr 11, 2014
@cdeil cdeil added this to the 0.2 milestone Apr 11, 2014
@cdeil cdeil self-assigned this Apr 11, 2014
@cdeil
Copy link
Contributor Author

cdeil commented Apr 11, 2014

I've asked this question on astropy-dev and @mdboom and @eteq have commented:
https://groups.google.com/forum/#!topic/astropy-dev/ryr5EcCkFeU

@cdeil
Copy link
Contributor Author

cdeil commented Apr 23, 2014

Filed Astropy issue: astropy/astropy#2364

@cdeil cdeil assigned ellisowen and unassigned cdeil and ellisowen May 2, 2014
@cdeil
Copy link
Contributor Author

cdeil commented Jul 21, 2014

Currently the following doctests fail:
https://gist.github.com/cdeil/d196ba086897e840aae7
Maybe if they are fixed this will work?

@cdeil cdeil modified the milestones: 0.3, 0.2 Apr 14, 2015
@cdeil cdeil self-assigned this Apr 14, 2015
@cdeil
Copy link
Contributor Author

cdeil commented May 30, 2015

Currently I'm getting these fails: https://gist.github.com/cdeil/97038aee3cf3bb5d48cb
Punting this issue to the 0.4 milestone ...

@cdeil cdeil modified the milestones: 0.4, 0.3 May 30, 2015
@cdeil cdeil modified the milestones: 0.4, 0.3 Aug 2, 2015
@cdeil cdeil modified the milestones: 0.5, 0.4 Oct 7, 2015
@cdeil cdeil added this to the 0.6 milestone Jul 7, 2016
@cdeil cdeil requested a review from bsipocz May 16, 2017 18:29
@cdeil
Copy link
Contributor Author

cdeil commented May 16, 2017

I've rebased, new builds running here: https://travis-ci.org/gammapy/gammapy/builds/232939654

Locally I tried python setup.py test -V and see

Running tests in lib.macosx-10.12-x86_64-3.6/gammapy docs.

but no extra lines listing if / which doctests ran. So I don't know if it's active or not.

@bsipocz - Can you please review the travis-ci log at https://travis-ci.org/gammapy/gammapy/jobs/232939668 (the "main" build we use for coverage) when ready and comment whether doctests are running or not (and how to tell)?

@bsipocz
Copy link
Member

bsipocz commented May 16, 2017

@cdeil - I'll have a look at it once I'm at home.
Ideally the docs/.../*rst files should be listed at the test run. I haven't got a better test for it (except that I think that the examples that use gammapy-extra should fail when it's not available).

@cdeil
Copy link
Contributor Author

cdeil commented May 17, 2017

travis-ci tests passed, but I don't see any docs tests running in the log locally or on travis-ci.
Probably something needs to be configured or changed for this to work (but I don't know what).
So let's not merge this PR before this is sorted out.

@bsipocz
Copy link
Member

bsipocz commented May 17, 2017

@cdeil - I'm assigning myself here, too, so it's more likely that I won't forget to get back to it.

@bsipocz bsipocz self-assigned this May 17, 2017
@cdeil cdeil modified the milestones: 0.7, 0.8 Nov 5, 2017
@cdeil cdeil modified the milestones: 0.8, 0.9 May 3, 2018
@cdeil cdeil modified the milestones: 0.9, 0.10 Oct 31, 2018
@cdeil cdeil modified the milestones: 0.10, 0.11 Jan 28, 2019
@cdeil cdeil modified the milestones: 0.11, 0.12 Mar 11, 2019
@cdeil cdeil modified the milestones: 0.12, 0.13 May 17, 2019
@bsipocz
Copy link
Member

bsipocz commented Jul 4, 2019

This needs a rebase. After that I see at least 10 errors and expect several failures, too, but none of the should be substantial.

@cdeil cdeil modified the milestones: 0.13, 0.14 Jul 4, 2019
@cdeil cdeil modified the milestones: 0.14, 0.15 Sep 5, 2019
@cdeil cdeil removed their assignment Nov 18, 2019
@adonath adonath modified the milestones: 0.15, 1.0 Dec 2, 2019
@adonath
Copy link
Member

adonath commented Jan 14, 2021

Doctests are now run as part of the CI build: https://github.com/gammapy/gammapy/blob/master/.github/workflows/ci.yml#L127, locally they can be run using the same command. Will close the PR now...

@adonath adonath closed this Jan 14, 2021
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.

4 participants