Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more module testing and upgrade to pytest #166

Merged
merged 23 commits into from
Jul 27, 2020
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: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
source=OrthoEvol
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ notifications:
install:
- "pip install --upgrade pip setuptools wheel"
- "pip install --only-binary=numpy,scipy numpy scipy"
- "pip install matplotlib ipython jupyter sympy nose"
- "pip install matplotlib ipython jupyter sympy pytest"
- "pip install -r requirements.txt"
# command to run nosetests
script: nosetests tests/ --verbosity=3
- "pip install ."
# command to run unittests via pytest
script:
- pytest tests/
20 changes: 10 additions & 10 deletions OrthoEvol/Cookies/cookie_jar.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _check_ingredients(self, cookie, path, no_input, extra_context):
self.cookielog.info('%s was created. ✔' % str(path))

def bake_the_repo(self, cookie_jar=None):
self.cookielog.warn('Creating directories from the Repository Cookie template.')
self.cookielog.warning('Creating directories from the Repository Cookie template.')
"""
This function creates a new repository. If a repository name
is given to the class, then it is given a name. If not, cookiecutter
Expand Down Expand Up @@ -163,7 +163,7 @@ def bake_the_user(self, cookie_jar=None):
:param cookie_jar: (Default value = None)
"""

self.cookielog.warn('Creating directories from the User Cookie template.')
self.cookielog.warning('Creating directories from the User Cookie template.')
if cookie_jar:
self.cookie_jar = cookie_jar

Expand All @@ -181,7 +181,7 @@ def bake_the_project(self, cookie_jar=None):
:return: A new project inside the user's project directory.
"""

self.cookielog.warn('Creating directories from the Project Cookie template.')
self.cookielog.warning('Creating directories from the Project Cookie template.')
if cookie_jar:
self.cookie_jar = cookie_jar
# Add the project
Expand All @@ -198,7 +198,7 @@ def bake_the_project(self, cookie_jar=None):
if self.exists(str(self.cookie_jar / Path(self.project))):
self.cookielog.info('Project exists. ✔')
else:
self.cookielog.warn('A project linked to a user/repository is being created.')
self.cookielog.warning('A project linked to a user/repository is being created.')
cookiecutter(str(self.Recipes.project_cookie), extra_context=e_c, no_input=no_input,
output_dir=str(self.cookie_jar))
# Logging
Expand All @@ -212,7 +212,7 @@ def bake_the_project(self, cookie_jar=None):
if self.exists(str(self.cookie_jar / Path(self.project))):
self.cookielog.info('Project exists. ✔')
else:
self.cookielog.warn('A basic standalone project is being created.')
self.cookielog.warning('A basic standalone project is being created.')
cookiecutter(str(self.Recipes.basic_project_cookie), extra_context=e_c, no_input=no_input,
output_dir=str(self.cookie_jar))
self.cookielog.info(
Expand Down Expand Up @@ -271,7 +271,7 @@ def bake_the_website(self, host, port, website_path, cookie_jar=None):
:param cookie_jar: (Default value = None)
"""

self.cookielog.warn('Creating directories from the Website Cookie template.')
self.cookielog.warning('Creating directories from the Website Cookie template.')
if cookie_jar:
self.cookie_jar = cookie_jar
# TODO-ROB: Add heavy logging here
Expand All @@ -290,8 +290,8 @@ def bake_the_website(self, host, port, website_path, cookie_jar=None):
run_script(script_path=str(script_path), cwd=str(website_path))
self.cookielog.info(
'Directories have been created for the Flask Web Server, %s. ✔' % self.website)
self.cookielog.warn('The %s Flask Server should now be running on http://%s:%s' %
(self.website, host, port))
self.cookielog.warning('The %s Flask Server should now be running on http://%s:%s' %
(self.website, host, port))

def bake_the_research(self, research_type, research, cookie_jar=None):
"""Create a directory for a new research project.
Expand All @@ -301,7 +301,7 @@ def bake_the_research(self, research_type, research, cookie_jar=None):
:param cookie_jar: (Default value = None)
"""

self.cookielog.warn('Creating directories from the Research Cookie template.')
self.cookielog.warning('Creating directories from the Research Cookie template.')
if cookie_jar:
self.cookie_jar = cookie_jar

Expand All @@ -320,7 +320,7 @@ def bake_the_app(self, app, cookie_jar=None):
:param cookie_jar: (Default value = None)
"""

self.cookielog.warn('Creating directories from the App Cookie template.')
self.cookielog.warning('Creating directories from the App Cookie template.')
if cookie_jar:
self.cookie_jar = cookie_jar
e_c = {"app_name": app}
Expand Down
14 changes: 9 additions & 5 deletions OrthoEvol/Orthologs/Blast/blast.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, project, method, acc_file, copy_from_package,
:param kwargs:"""

super().__init__(project=project, method=method, acc_file=acc_file,
copy_from_package=copy_from_package,
copy_from_package=copy_from_package,
ref_species=ref_species, template=template,
save_data=save_data, verbose=verbose, **kwargs)

Expand Down Expand Up @@ -246,7 +246,7 @@ def configure(self, query_accessions, query_organism, auto_start=False):

self.blastn_log.debug('Blast configuration has begun.')
self.blastn_log.debug('Configuring the accession file.')

if self.ref_species:
query_organism = self.ref_species

Expand Down Expand Up @@ -468,7 +468,7 @@ class OrthoBlastN(BaseBlastN):

def __init__(self, project="orthology-gpcr", project_path=os.getcwd(),
method=1, template=None, save_data=True, acc_file="gpcr.csv",
copy_from_package=True, **kwargs):
copy_from_package=True, auto_start=False, **kwargs):
"""This class inherits from the BaseBlastN class.

This class utilizes it's parent classes to search a standalone
Expand All @@ -494,6 +494,7 @@ def __init__(self, project="orthology-gpcr", project_path=os.getcwd(),
self.proj_mana = None
self.acc_file = acc_file
self.copy_from_package = copy_from_package
self.auto_start = auto_start

# Initialize class
super().__init__(project=project, method=method, template=template,
Expand All @@ -503,11 +504,14 @@ def __init__(self, project="orthology-gpcr", project_path=os.getcwd(),
taxon_file=self.taxon_file,
post_blast=self.__post_blast,
project_path=self.project_path,
proj_mana=self.proj_mana, **kwargs)
proj_mana=self.proj_mana,
auto_start=self.auto_start,
**kwargs)

def run(self):
"""Run the blast using a default configuration."""
self.configure(self.blast_human, self.ref_species, auto_start=True)
self.configure(self.blast_human, self.ref_species,
auto_start=self.auto_start)


class BlastFailure(BaseException):
Expand Down
Loading