rrwick / Filtlong

quality filtering tool for long reads
GNU General Public License v3.0
289 stars 28 forks source link

Several issues in test suite #15

Open tillea opened 5 years ago

tillea commented 5 years ago

Hi, I tried to build Filtlong on Debian and was running the test suite:

python3 -m unittest
.......................FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF..
======================================================================
FAIL: test_sort_high_threshold_1 (test.test_sort.TestSort)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/andreas/debian-maintain/salsa/med-team/0_prospective/build-area/filtlong-0.2.0/test/test_sort.py", line 93, in test_sort_high_threshold_1
    self.assertTrue('target: 100,000 bp' in console_out)
AssertionError: False is not true

======================================================================
FAIL: test_sort_high_threshold_1_assembly_ref (test.test_sort.TestSort)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/andreas/debian-maintain/salsa/med-team/0_prospective/build-area/filtlong-0.2.0/test/test_sort.py", line 101, in test_sort_high_threshold_1_assembly_ref
    self.assertTrue('target: 100,000 bp' in console_out)
AssertionError: False is not true

======================================================================
FAIL: test_sort_high_threshold_1_assembly_ref_fasta (test.test_sort.TestSort)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/andreas/debian-maintain/salsa/med-team/0_prospective/build-area/filtlong-0.2.0/test/test_sort.py", line 117, in test_sort_high_threshold_1_assembly_ref_fasta
    self.assertTrue('target: 100,000 bp' in console_out)
AssertionError: False is not true

...
======================================================================
FAIL: test_trim_2 (test.test_trim.TestTrim)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/andreas/debian-maintain/salsa/med-team/0_prospective/build-area/filtlong-0.2.0/test/test_trim.py", line 87, in test_trim_2
    self.assertTrue('4 reads (4,901 bp)' in console_out)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 68 tests in 43.572s

FAILED (failures=42)

Please let me know if you need further information. Kind regards, Andreas.

tillea commented 5 years ago

Hi again, is there any additional information you might need to reproduce the unittest errors?

kapsakcj commented 5 years ago

I go the same exact errors while running the unit test on ubuntu 16 (in a docker container). This was using the v0.2.0 release. Happy to help debug too.

python3 -m unittest
.......................FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF..
======================================================================
FAIL: test_sort_high_threshold_1 (test.test_sort.TestSort)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Filtlong-0.2.0/test/test_sort.py", line 93, in test_sort_high_threshold_1
    self.assertTrue('target: 100,000 bp' in console_out)
AssertionError: False is not true

======================================================================
FAIL: test_sort_high_threshold_1_assembly_ref (test.test_sort.TestSort)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Filtlong-0.2.0/test/test_sort.py", line 101, in test_sort_high_threshold_1_assembly_ref
    self.assertTrue('target: 100,000 bp' in console_out)
AssertionError: False is not true

...

Ran 68 tests in 41.534s

FAILED (failures=42)
tillea commented 4 years ago

Ping? Is there any intend to work on this issue?

ballaneypranav commented 4 years ago

Hi, I've noticed that Filtlong prints numbers formatted according to the locale (100,000 or 100000), but the unittest scripts expect them to be formatted as 100,000. For the Debian package, we've solved the issue by patching the test files to ignore commas in numbers.

You can take a look at the patch here: https://salsa.debian.org/med-team/filtlong/-/blob/master/debian/patches/ignore_locales_in_test_output.patch

Regards, Pranav

dzolier commented 2 years ago

Hi, I've noticed that Filtlong prints numbers formatted according to the locale (100,000 or 100000), but the unittest scripts expect them to be formatted as 100,000. For the Debian package, we've solved the issue by patching the test files to ignore commas in numbers.

You can take a look at the patch here: https://salsa.debian.org/med-team/filtlong/-/blob/master/debian/patches/ignore_locales_in_test_output.patch

Regards, Pranav

I wrote a few shell commands to address this issue for the three offending files:

cd filtlong_folder/test
perl -pi -e 's/(?<=\d),(?=\d)//g' test_sort.py
perl -pi -e 's/(?<=\d),(?=\d)//g' test_split.py
perl -pi -e 's/(?<=\d),(?=\d)//g' test_trim.py
sed -i "s/ bp' in console_out/ bp' in console_out.replace(',', '')/g" test_sort.py
sed -i "s/ bp)' in console_out/ bp)' in console_out.replace(',', '')/g" test_split.py
sed -i "s/ bp)' in console_out/ bp)' in console_out.replace(',', '')/g" test_trim.py
cd filtlong_folder

After these, I got a successful run of python3 -m unittest More specifically, the results were:

....................................................................
----------------------------------------------------------------------
Ran 68 tests in 50.953s

OK