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

Ac tests #178

Merged
merged 9 commits into from
Oct 26, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/cgatcore_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12"]

defaults:
run:
Expand Down Expand Up @@ -43,5 +43,5 @@ jobs:
conda list
- name: Test
run: |
python setup.py install
pip install .
./all-tests.sh
21 changes: 13 additions & 8 deletions all-tests.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#! /bin/bash
#!/bin/bash

set -xue

# Run code style checks
pycodestyle

# Run the template pipeline script with the `make all` command
python tests/template_pipeline.py make all
nosetests -v tests/test_import.py
nosetests -v tests/test_iotools.py
nosetests -v tests/test_pipeline_cluster.py
nosetests -v tests/test_pipeline_control.py
nosetests -v tests/test_pipeline_execution.py
pytest tests/test_pipeline_cli.py
pytest tests/test_pipeline_actions.py

# Run tests using pytest
pytest -v tests/test_import.py
pytest -v tests/test_iotools.py
pytest -v tests/test_pipeline_cluster.py
pytest -v tests/test_pipeline_control.py
pytest -v tests/test_pipeline_execution.py
pytest -v tests/test_pipeline_cli.py
pytest -v tests/test_pipeline_actions.py
2 changes: 1 addition & 1 deletion cgatcore/csvutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def readTable(infile,
raise ValueError(
"missing elements in line %s, received=%s, "
"expected=%s" %
(r, str(row), str(fields)))
(r, str(row), str(fields)))

raise ValueError

Expand Down
4 changes: 2 additions & 2 deletions cgatcore/iotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def bytes2human(n, format='%(value).1f%(symbol)s', symbols='customary'):
symbols = SYMBOLS[symbols]
prefix = {}
for i, s in enumerate(symbols[1:]):
prefix[s] = 1 << (i+1)*10
prefix[s] = 1 << (i + 1) * 10
for symbol in reversed(symbols[1:]):
if n >= prefix[symbol]:
value = float(n) / prefix[symbol]
Expand Down Expand Up @@ -668,7 +668,7 @@ def human2bytes(s):
raise ValueError("can't interpret %r" % init)
prefix = {sset[0]: 1}
for i, s in enumerate(sset[1:]):
prefix[s] = 1 << (i+1)*10
prefix[s] = 1 << (i + 1) * 10

return int(num * prefix[letter])

Expand Down
4 changes: 2 additions & 2 deletions cgatcore/logfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

RuntimeInformation = collections.namedtuple(
"RuntimeInformation",
"script options jobid host has_finished " +
"start_date end_date " +
"script options jobid host has_finished "
"start_date end_date "
"wall utime stime cutime cstime")

RX_START = re.compile(r"output generated by (\S+) (.*)")
Expand Down
4 changes: 2 additions & 2 deletions cgatcore/pipeline/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,8 +1386,8 @@ def run_pickled(params):
try:
function = getattr(module, func_name)
except AttributeError as msg:
raise AttributeError(msg.message +
"unknown function, available functions are: %s" %
raise AttributeError(msg.message
+ "unknown function, available functions are: %s" %
",".join([x for x in dir(module)
if not x.startswith("_")]))

Expand Down
3 changes: 1 addition & 2 deletions cgatcore/pipeline/farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ def chunk_iterator_regex_split(infile, args, prefix, use_header=False):
if line[0] == "#":
continue
if rex.search(line[:-1]):
if n > 0 and (n % chunk_size == 0 or
(max_lines and nlines > max_lines)):
if n > 0 and (n % chunk_size == 0 or (max_lines and nlines > max_lines)):
outfile.close()
yield filename
filename = "%s/%010i.in" % (prefix, n)
Expand Down
4 changes: 2 additions & 2 deletions cgatcore/pipeline/logstash_formatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def format(self, record):
now = datetime.datetime.utcnow()
event_time = getattr(record,
"eventtime",
now.strftime("%Y-%m-%dT%H:%M:%S") +
".%03d" % (now.microsecond / 1000) + "Z")
now.strftime("%Y-%m-%dT%H:%M:%S")
+ ".%03d" % (now.microsecond / 1000) + "Z")
base_log = {'@timestamp': event_time,
'@version': 1,
'source_host': self.source_host}
Expand Down
3 changes: 1 addition & 2 deletions cgatcore/pipeline/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ def _doc(func):
# currently hard-coded, can be derived
# from doc string?
if not replace:
lines.insert(x+1, " " * 4 +
func.__doc__)
lines.insert(x + 1, " " * 4 + func.__doc__)
func.__doc__ = "\n".join(lines)
else:
func.__doc__ = value.__doc__
Expand Down
6 changes: 3 additions & 3 deletions cgatcore/remote/ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def __init__(self, *args, stay_on_remote=False, immediate_close=False, **kwargs)
@contextmanager
def ftpc(self):

if (not hasattr(self, "conn") or
(hasattr(self, "conn") and
not isinstance(self.conn, ftputil.FTPHost))) or self.immediate_close:
if (not hasattr(self, "conn")
or (hasattr(self, "conn") and not isinstance(self.conn, ftputil.FTPHost)))
or self.immediate_close:
args_use = self.provider.args
if len(self.args):
args_use = self.args
Expand Down
Loading
Loading