Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ install:
pyzmq networkx pyparsing natsort mock future libgfortran seaborn nltk pandas
matplotlib scipy numpy h5py
- source activate qiita
- 'echo "backend: Agg" > ~/matplotlibrc'
- pip install sphinx sphinx-bootstrap-theme nose-timer codecov Click
- git clone https://github.com/nicolasff/webdis
- pushd webdis
- make
- ./webdis &
- popd
# export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/9.5/bin/"
- travis_retry pip install . --process-dependency-links
# loading redbiom with Qiita's test set
# but first let's make sure redis is empty
Expand Down
2 changes: 1 addition & 1 deletion qiita_core/configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self):

# Parse the configuration file
config = ConfigParser()
with open(conf_fp, 'U') as conf_file:
with open(conf_fp, newline=None) as conf_file:
config.readfp(conf_file)

_required_sections = {'main', 'redis', 'postgres', 'smtp', 'ebi',
Expand Down
6 changes: 3 additions & 3 deletions qiita_core/tests/test_configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setUp(self):
environ['QIITA_CONFIG_FP'] = self.conf_fp

self.conf = ConfigParser()
with open(self.conf_fp, 'U') as f:
with open(self.conf_fp, newline=None) as f:
self.conf.readfp(f)

def tearDown(self):
Expand Down Expand Up @@ -136,9 +136,9 @@ def test_get_main(self):
with warnings.catch_warnings(record=True) as warns:
obs._get_main(self.conf)

obs_warns = [str(w.message) for w in warns]
obs_warns = [str(w) for w in warns]
exp_warns = ['Random cookie secret generated.']
self.assertItemsEqual(obs_warns, exp_warns)
self.assertCountEqual(obs_warns, exp_warns)

self.assertNotEqual(obs.cookie_secret, "SECRET")
# Test default base_data_dir
Expand Down
2 changes: 1 addition & 1 deletion qiita_core/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_get_release_info(self):
# and then we will test that at least the 2nd element is correct
self.assertNotEqual(biom_metadata_release, ('', '', ''))
self.assertEqual(biom_metadata_release[1],
'releases/QIITA-private.tgz')
b'releases/QIITA-private.tgz')
self.assertEqual(archive_release, ('', '', ''))

generate_plugin_releases()
Expand Down
10 changes: 5 additions & 5 deletions qiita_db/environment_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def create_layout(test=False, verbose=False):
if verbose:
print('Building SQL layout')
# Create the schema
with open(LAYOUT_FP, 'U') as f:
with open(LAYOUT_FP, newline=None) as f:
qdb.sql_connection.TRN.add(f.read())
qdb.sql_connection.TRN.execute()


def _populate_test_db():
with qdb.sql_connection.TRN:
with open(POPULATE_FP, 'U') as f:
with open(POPULATE_FP, newline=None) as f:
qdb.sql_connection.TRN.add(f.read())
qdb.sql_connection.TRN.execute()

Expand Down Expand Up @@ -194,7 +194,7 @@ def make_environment(load_ontologies, download_reference, add_demo_user):
except ValueError as error:
# if database exists ignore
msg = 'database "%s" already exists' % qiita_config.database
if msg in error.message:
if msg in str(error):
print("Database exits, let's make sure it's test")
with qdb.sql_connection.TRN:
# Insert the settings values to the database
Expand All @@ -218,7 +218,7 @@ def make_environment(load_ontologies, download_reference, add_demo_user):
verbose = True
if create_settings_table:
# Build the SQL layout into the database
with open(SETTINGS_FP, 'U') as f:
with open(SETTINGS_FP, newline=None) as f:
qdb.sql_connection.TRN.add(f.read())
qdb.sql_connection.TRN.execute()

Expand Down Expand Up @@ -425,7 +425,7 @@ def patch(patches_dir=PATCHES_DIR, verbose=False, test=False):
_populate_test_db()

with qdb.sql_connection.TRN:
with open(sql_patch_fp, 'U') as patch_file:
with open(sql_patch_fp, newline=None) as patch_file:
if verbose:
print('\tApplying patch %s...' % sql_patch_filename)
qdb.sql_connection.TRN.add(patch_file.read())
Expand Down
2 changes: 1 addition & 1 deletion qiita_db/handlers/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def write_error(self, status_code, **kwargs):
'ERROR:\n%s\nTRACE:\n%s\nHTTP INFO:\n%s\n' %
(error, trace_info, request_info))

message = exc_info[1].message
message = str(exc_info[1])
if hasattr(exc_info[1], 'log_message'):
message = exc_info[1].log_message

Expand Down
3 changes: 2 additions & 1 deletion qiita_db/handlers/processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def post(self, job_id):
cmd = qiita_plugin.get_command('complete_job')
params = qdb.software.Parameters.load(
cmd, values_dict={'job_id': job_id,
'payload': self.request.body})
'payload': self.request.body.decode(
'ascii')})
job = qdb.processing_job.ProcessingJob.create(job.user, params)
job.submit()

Expand Down
2 changes: 1 addition & 1 deletion qiita_db/handlers/tests/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_get(self):
obs = loads(obs.body)
exp = ['1.SKM4.640180', '1.SKB8.640193', '1.SKD8.640184',
'1.SKM9.640192', '1.SKB7.640196']
self.assertItemsEqual(obs, exp)
self.assertCountEqual(obs, exp)

exp = {'platform': 'Illumina', 'longitude': '95.5088566087',
'experiment_center': 'ANL', 'center_name': 'ANL',
Expand Down
4 changes: 2 additions & 2 deletions qiita_db/handlers/tests/test_prep_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_get(self):
'1.SKD3.640198', '1.SKB5.640181', '1.SKB4.640189',
'1.SKB9.640200', '1.SKM9.640192', '1.SKD8.640184',
'1.SKM5.640177', '1.SKM7.640188', '1.SKD7.640191']
self.assertItemsEqual(obs.keys(), exp)
self.assertCountEqual(obs.keys(), exp)

obs = obs['1.SKB1.640202']
exp = {
Expand Down Expand Up @@ -152,7 +152,7 @@ def test_post(self):
self.assertEqual(obs.keys(), ['prep'])

pt = qdb.metadata_template.prep_template.PrepTemplate(obs['prep'])
self.assertItemsEqual(pt.keys(), ['1.SKB8.640193', '1.SKD8.640184'])
self.assertCountEqual(pt.keys(), ['1.SKB8.640193', '1.SKD8.640184'])

# testing that a new prep doesn't break the call due to empty artifact
obs = self.get('/qiita_db/prep_template/%d/' % pt.id,
Expand Down
6 changes: 3 additions & 3 deletions qiita_db/handlers/tests/test_processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_post_job_not_running(self):
'/qiita_db/jobs/063e553b-327c-4818-ab4a-adfe58e49860/complete/',
payload, headers=self.header)
self.assertEqual(obs.code, 403)
self.assertEqual(obs.body,
self.assertEqual(obs.body.decode('ascii'),
"Can't complete job: not in a running state")

def test_post_job_failure(self):
Expand Down Expand Up @@ -280,7 +280,7 @@ def test_post_processing_job(self):
self.assertEqual(obs.code, 200)

obs = loads(obs.body)
self.assertEqual(obs.keys(), ['job'])
self.assertEqual(list(obs.keys()), ['job'])
self.assertIsNotNone(obs['job'])

def test_post_processing_job_status(self):
Expand All @@ -302,7 +302,7 @@ def test_post_processing_job_status(self):
self.assertEqual(obs.code, 200)

obs = loads(obs.body)
self.assertEqual(obs.keys(), ['job'])
self.assertEqual(list(obs.keys()), ['job'])
job_id = obs['job']
self.assertTrue(qdb.processing_job.ProcessingJob.exists(job_id))
self.assertEqual(qdb.processing_job.ProcessingJob(job_id).status,
Expand Down
2 changes: 1 addition & 1 deletion qiita_db/handlers/tests/test_sample_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_get(self):
'1.SKD3.640198', '1.SKB5.640181', '1.SKB4.640189',
'1.SKB9.640200', '1.SKM9.640192', '1.SKD8.640184',
'1.SKM5.640177', '1.SKM7.640188', '1.SKD7.640191']
self.assertItemsEqual(obs.keys(), exp)
self.assertCountEqual(obs.keys(), exp)

obs = obs['1.SKB1.640202']
exp = {'qiita_study_id': '1', 'physical_specimen_location': 'ANL',
Expand Down
1 change: 0 additions & 1 deletion qiita_db/meta_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ def generate_biom_and_metadata_release(study_status='public'):

txt_hd.seek(0)
info = TarInfo(name='%s-%s-%s.txt' % (portal, study_status, ts))
info.size = len(txt_hd.buf)
tgz.addfile(tarinfo=info, fileobj=txt_hd)

with open(tgz_name, "rb") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_identify_pgsql_reserved_words(self):
'select',
'column',
'just_fine1'])
self.assertItemsEqual(set(results), {'column', 'select'})
self.assertCountEqual(set(results), {'column', 'select'})

def test_identify_invalid_characters(self):
MT = qdb.metadata_template.base_metadata_template.MetadataTemplate
Expand All @@ -87,7 +87,7 @@ def test_identify_invalid_characters(self):
'this|is',
'4column',
'just_fine2'])
self.assertItemsEqual(set(results), {'tax on',
self.assertCountEqual(set(results), {'tax on',
'bla.',
'.',
'{',
Expand Down
12 changes: 6 additions & 6 deletions qiita_db/metadata_template/test/test_prep_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_metadata_headers(self):
'primer', 'run_center', 'run_date', 'run_prefix', 'samp_size',
'sample_center', 'sequencing_meth', 'study_center',
'target_gene', 'target_subfragment']
self.assertItemsEqual(obs, exp)
self.assertCountEqual(obs, exp)

def test_setitem(self):
with self.assertRaises(qdb.exceptions.QiitaDBColumnError):
Expand Down Expand Up @@ -877,7 +877,7 @@ def _common_creation_checks(self, pt, fp_count, name):
'instrument_model', 'experiment_design_description',
'library_construction_protocol', 'center_name',
'center_project_name', 'emp_status'}
self.assertItemsEqual(pt.categories(), exp_categories)
self.assertCountEqual(pt.categories(), exp_categories)
exp_dict = {
'%s.SKB7.640196' % self.test_study.id: {
'barcode': 'CCTCTGAGAGCT',
Expand Down Expand Up @@ -1010,7 +1010,7 @@ def test_create_warning(self):
'instrument_model', 'experiment_design_description',
'library_construction_protocol', 'center_name',
'center_project_name', 'emp_status'}
self.assertItemsEqual(pt.categories(), exp_categories)
self.assertCountEqual(pt.categories(), exp_categories)
exp_dict = {
'%s.SKB7.640196' % self.test_study.id: {
'ebi_submission_accession': None,
Expand Down Expand Up @@ -1134,7 +1134,7 @@ def test_to_file(self):
self.metadata, self.test_study, self.data_type)
pt.to_file(fp)
self._clean_up_files.append(fp)
with open(fp, 'U') as f:
with open(fp, newline=None) as f:
obs = f.read()
self.assertEqual(obs, EXP_PREP_TEMPLATE.format(pt.id))

Expand Down Expand Up @@ -1329,7 +1329,7 @@ def test_extend_add_cols(self):
'center_project_name': 'Test Project',
'emp_status': 'EMP',
'new_col': 'val3'}}
self.assertItemsEqual(obs, exp)
self.assertCountEqual(obs, exp)

def test_extend_update(self):
pt = qdb.metadata_template.prep_template.PrepTemplate.create(
Expand Down Expand Up @@ -1388,7 +1388,7 @@ def test_extend_update(self):
'emp_status': 'EMP',
'new_col': 'val3'}}

self.assertItemsEqual(obs, exp)
self.assertCountEqual(obs, exp)

def test_ebi_experiment_accessions(self):
obs = self.tester.ebi_experiment_accessions
Expand Down
Loading