mmore500 / hstrat

hstrat enables phylogenetic inference on distributed digital evolution populations
Other
3 stars 2 forks source link

Additional tests tweaking #60

Closed kgd-al closed 1 year ago

kgd-al commented 1 year ago

This is part of the ongoing joss review https://github.com/openjournals/joss-reviews/issues/4866

On a rather new python environment the tests cannot run without additional dependencies. I would let more python-savy people comment on whether they should be included in the auto-installed dependencies.

If pytest is not installed the tests fail with an unexplicit error

which_python /home/mann/work/code/vu/joss-review/venv/bin/python3.8
/home/mann/work/code/vu/joss-review/venv/bin/python3.8: can't find '__main__' module in ''

If either of iterify, teeplot or scipy are not installed the test suite (rightfully) fails

ImportError while importing test module '/home/mann/work/code/vu/joss-review/hstrat/tests/test_hstrat/test_juxtaposition/test_calc_rank_of_first_retained_disparity_between.py'.
Hint: make sure your test modules/packages have valid Python names.                                                                                                                                                              
Traceback:                                                                                                                                                                                                                       
/usr/lib/python3.8/importlib/__init__.py:127: in import_module                                                                                                                                                                   
    return _bootstrap._gcd_import(name[level:], package, level)                                                                                                                                                                  
hstrat/tests/test_hstrat/test_juxtaposition/test_calc_rank_of_first_retained_disparity_between.py:4: in <module>                                                                                                                 
    from iterify import iterify                                                                                                                                                                                                  
E   ModuleNotFoundError: No module named 'iterify'  
ImportError while importing test module '/home/mann/work/code/vu/joss-review/hstrat/tests/test_hstrat/test_stratum_retention_viz/test_plot/test_mrca_uncertainty_absolute_barplot.py'.
Hint: make sure your test modules/packages have valid Python names.                                                                                                                                                              
Traceback:                                                                                                                                                                                                                       
/usr/lib/python3.8/importlib/__init__.py:127: in import_module                                                                                                                                                                   
    return _bootstrap._gcd_import(name[level:], package, level)                                                                                                                                                                  
hstrat/tests/test_hstrat/test_stratum_retention_viz/test_plot/test_mrca_uncertainty_absolute_barplot.py:4: in <module>                                                                                                           
    from teeplot import teeplot as tp                                                                                                                                                                                            
E   ModuleNotFoundError: No module named 'teeplot' 
ImportError while importing test module '/home/mann/work/code/vu/joss-review/hstrat/tests/test_hstrat/test_phylogenetic_inference/test_pairwise/test_calc_rank_of_mrca_bounds_between.py'.
Hint: make sure your test modules/packages have valid Python names.                                                                                                                                                              
Traceback:                                                                                                                                                                                                                       
/usr/lib/python3.8/importlib/__init__.py:127: in import_module                                                                                                                                                                   
    return _bootstrap._gcd_import(name[level:], package, level)                                                                                                                                                                  
hstrat/tests/test_hstrat/test_phylogenetic_inference/test_pairwise/test_calc_rank_of_mrca_bounds_between.py:7: in <module>                                                                                                       
    from scipy import stats                                                                                                                                                                                                      
E   ModuleNotFoundError: No module named 'scipy' 

On my machine (python 3.8.10) one warning remains although, admittedly, not a crucial one:

tests/test_hstrat/test_stratum_retention_viz/test_plot/test_mrca_uncertainty_relative_barplot.py::test_docplots[policy10]
  /home/mann/work/code/vu/joss-review/hstrat/hstrat/stratum_retention_viz/plot/_mrca_uncertainty_relative_barplot.py:37: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`.
    fig = plt.figure()
mmore500 commented 1 year ago

Agreed that this should be improved. Put together a PR (#62) that will detect missing testing requirements and direct the user to documentation on how to install them.

mmore500 commented 1 year ago

63 should fix that annoying matplotlib warning!