cultivarium / MicrobeMod

A toolkit for exploring prokaryotic methylation and base modifications in nanopore sequencing
MIT License
34 stars 1 forks source link

pytest fails in /tmp/... #7

Closed jowodo closed 8 months ago

jowodo commented 8 months ago

When I try to install MicrobeMod in a temporary dir (to only copy to prefix, after installation is successful), it fails because the strip function in tests/test_rm.py works different than expected[1,2].

[1] https://github.com/cultivarium/MicrobeMod/blob/main/tests/test_rm.py#L124 [2] https://docs.python.org/3/library/stdtypes.html#str.strip

jowodo commented 8 months ago

This is how I install:

TMPDIR=$(mktemp -d) 
pushd $TMPDIR
git clone https://github.com/cultivarium/MicrobeMod.git
cd MicrobeMod
git checkout 6899972 # https://github.com/cultivarium/MicrobeMod/issues/6
# when issue is resolved
# git checkout v$VERSION
cd MicrobeMod
python3 download_db.py
cd ..
pip3 install .
pytest -rP -k test_dependencies
pytest
cd ..
mv MicrbeMod $PREFIX
alexcritschristoph commented 8 months ago

Thanks for pointing it out, I'll prioritize fixing this!

jowodo commented 8 months ago

This is what worked for me:

TMPDIR=$(mktemp -d)
pushd $TMPDIR
git clone https://github.com/cultivarium/MicrobeMod.git
cd MicrobeMod
git checkout 6899972 # https://github.com/cultivarium/MicrobeMod/issues/6
# when issue is resolved
# git checkout v$INSTALLVERSION
cd MicrobeMod
python3 download_db.py
cd ..
pip3 install .
pytest -rP -k test_dependencies
# https://github.com/cultivarium/MicrobeMod/issues/7
sed -i "s@.strip(\"/test\")@+\"/../\"@" tests/test_rm.py
pytest
cd ..
mv MicrobeMod $PREFIX
sed "s/python/python3/" $PREFIX/bin/MicrobeMod

EDIT: added the last sed command since python2 is long end of life and python3 does not come with python as symbolic link to python3 in most OS.

alexcritschristoph commented 8 months ago

Should be fixed now https://github.com/cultivarium/MicrobeMod/pull/8