Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions qiita_db/metadata_template/test/test_prep_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from os import close, remove
from os.path import join, basename
from collections import Iterable
import warnings

import numpy.testing as npt
import pandas as pd
Expand Down Expand Up @@ -1307,9 +1308,20 @@ def test_check_restrictions(self):
self.assertEqual(obs, set())

del self.metadata['primer']
pt = npt.assert_warns(QiitaDBWarning, PrepTemplate.create,
self.metadata, self.new_raw_data,
self.test_study, self.data_type)

caught_QiitaDBWarning = False

with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
pt = PrepTemplate.create(self.metadata, self.new_raw_data,
self.test_study, self.data_type)

# There might be several warnings raised. Make sure one of them
# is a QiitaDBWarning
if any([_w.category == QiitaDBWarning for _w in w]):
caught_QiitaDBWarning = True

self.assertTrue(caught_QiitaDBWarning)

obs = pt.check_restrictions(
[PREP_TEMPLATE_COLUMNS['EBI'],
Expand Down