Skip to content

Commit

Permalink
Updated tests and pandas code
Browse files Browse the repository at this point in the history
  • Loading branch information
wfondrie committed Jul 16, 2021
1 parent 0878cba commit d67a2f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mokapot/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def load_model(model_file):
model.is_trained = True

# Then try loading it with pickle:
except KeyError:
except (KeyError, UnicodeDecodeError):
logging.info("Loading mokapot model.")
with open(model_file, "rb") as mod_in:
model = pickle.load(mod_in)
Expand Down
17 changes: 17 additions & 0 deletions tests/system_tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import pytest
import pandas as pd

# Warnings are errors for these tests
pytestmark = pytest.mark.filterwarnings("error")


@pytest.fixture
def scope_files():
Expand Down Expand Up @@ -78,6 +81,20 @@ def test_cli_options(tmp_path, scope_files):
tmp_path, f"blah.{file_bases[1]}.mokapot.peptides.txt"
).exists()

# Test keep_decoys:
assert Path(
tmp_path, f"blah.{file_bases[0]}.mokapot.decoy.psms.txt"
).exists()
assert Path(
tmp_path, f"blah.{file_bases[0]}.mokapot.decoy.peptides.txt"
).exists()
assert Path(
tmp_path, f"blah.{file_bases[1]}.mokapot.decoy.psms.txt"
).exists()
assert Path(
tmp_path, f"blah.{file_bases[1]}.mokapot.decoy.peptides.txt"
).exists()


def test_cli_aggregate(tmp_path, scope_files):
"""Test that aggregate results in one result file."""
Expand Down

0 comments on commit d67a2f9

Please sign in to comment.