DataMedSci / beprof

Beam Profile Analysing Tools
MIT License
2 stars 2 forks source link

#63 - travis doctest targets #121

Closed antnieszka closed 7 years ago

codecov-io commented 7 years ago

Current coverage is 68.22% (diff: 100%)

Merging #121 into master will increase coverage by 0.26%

@@             master       #121   diff @@
==========================================
  Files             7          7          
  Lines           768        768          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            522        524     +2   
+ Misses          246        244     -2   
  Partials          0          0          

Powered by Codecov. Last update 773045f...4b07919

grzanka commented 7 years ago

I see you've added several new targets to travis. This leads to much longer execution time.

This time could be reduced it doctests would be called as any other test. What about creating beprof/tests/test_doctest.py file and calling the tests from there ? Then it won't be necessary to have extra tox configuration and extra travis configuration.

See for example https://docs.python.org/2/library/doctest.html#unittest-api

antnieszka commented 7 years ago

And run this test_doctest.py in the same travis target as tox tests? Like: -> execute tox -> execute test_doctest.py

Another thing - arch linux builds fail...

warning: failed to retrieve some files
downloading python-pip-8.1.2-1-any.pkg.tar.xz...
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
grzanka commented 7 years ago

Add a unittest test_doctest.py which will call doctests (see doctest unittest api). When typing tox, pytest will be executed. It will scan beprof\tests for all test*py files and execute all of them (including doctest).

antnieszka commented 7 years ago

@grzanka I found a probably easier solution: http://doc.pytest.org/en/latest/doctest.html

ant6% ➜ pytest --doctest-modules
Test session starts (platform: linux, Python 3.4.5, pytest 3.0.4, pytest-sugar 0.7.1)
rootdir: /home/ant6/PycharmProjects/beprof, inifile: 
plugins: sugar-0.7.1, timeout-1.2.0, xdist-1.15.0, cov-2.4.0

 build/lib/beprof/curve.py ✓✓✓✓✓                                                                                                                                                                                      10% ▉         
 build/lib/beprof/functions.py ✓                                                                                                                                                                                      12% █▎        
 build/lib/beprof/profile.py ✓✓                                                                                                                                                                                       15% █▋        
 build/lib/beprof/tests/test_curve.py ✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓                                                                                                                                                          58% █████▊    
 build/lib/beprof/tests/test_profile.py ✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓                                                                                                                                                       100% ██████████

Results (0.15s):
      52 passed
antnieszka commented 7 years ago

Speaking of speed - why do we need OSX tests at all? The really slow down builds.

antnieszka commented 7 years ago

Some travis builds are complete: ================= 52 passed, 1 pytest-warnings in 2.47 seconds ================= Number of tests increased, I think this works... although I wish I could see the whole log.

antnieszka commented 7 years ago

Packaging failed:

lists of files in version control and sdist do not match!
missing from sdist:
  pytest.ini
suggested MANIFEST.in rules:
  include pytest.ini

Should I include this file or exclude?

antnieszka commented 7 years ago

i'll include pytest.ini - we will probably use pytest as a test-runner, so it may be useful.