ReactionMechanismGenerator / RMG-Py

Python version of the amazing Reaction Mechanism Generator (RMG).
http://reactionmechanismgenerator.github.io/RMG-Py/
Other
395 stars 228 forks source link

SRC_DIR cannot be used in conda-build test section any more #922

Closed KEHANG closed 7 years ago

KEHANG commented 7 years ago

This is a new change made by conda-build (https://github.com/conda/conda-build/pull/1630). Basically, the source files (SRC_DIR) will be deleted right before testing phase starts for some safety purpose. However, RMG-Py and other RMG related pkgs (like openbabel in conda-recipes) are still using SRC_DIR in testing phase, e.g. in the meta.yaml of RMG-Py

test:
  requires:
    - nose
  imports:
    - rmgpy
commands:
    - cp $PREFIX/lib/python2.7/site-packages/rmgpy/rmgrc $SRC_DIR [unix]
    - make -C $SRC_DIR test [unix]

and meta.yaml of openbabel:

test:
  imports:
    - openbabel
    - pybel
  commands:
    - cd $SRC_DIR/test ; python test_pybel.py [unix]
    - cd $SRC_DIR/test ; python testbabel.py [unix]
    - cd $SRC_DIR/test ; python testkekule.py [unix]
    - cd $SRC_DIR/test ; python testbindings.py [unix]

Which already starts causing troubles for new binary generations. New recipes will be updated soon.

KEHANG commented 7 years ago

To be precise, $SRC_DIR points to different directories at different phases (build phase vs. test phase)

KEHANG commented 7 years ago

A quick fix would be to add the following section in meta.yaml:

test:
  source_files:
    - '*'

meaning copy all the source files to test temporary folder. But that means the binary package needs files that are not included in the package for testing.

A more elegant solution would be including those additional files (mostly test data for unit tests) to the package setup.py. Seems so far python setup.py install only includes modules (code files), I'll try to include data files in setup.py. (as suggested by here) Any comments/suggestions are welcome along the way.

KEHANG commented 7 years ago

It turns out most unit test modules are not included in binary package of RMG-Py. I can understand why is that. So even I include data files in binary, we cannot fully test the package on its own. Thusm I will stick to the first solution for now: test using source files.

If in the future when we allow binary users to access to all unit test modules, we can always include data files in setup.py and remove the source_files in meta.yaml.