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
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
- name: Lint with flake8, black, isort, pydocstyle
run: |
flake8 bashplot/ --count --max-line-length=88 --ignore=W293,W291 --statistic
flake8 bashplot/ --count --statistic
black . --check -v
isort . --check -v
flake8 . --count --exit-zero --max-complexity=10 --statistics
Expand All @@ -40,7 +40,7 @@ jobs:
pip install .
- name: Test with pytest and coverage
run: |
coverage run -m pytest test/test*.py -vv
coverage run -m pytest -vv
coverage report -m
coverage xml
- name: Codecov
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ steps:
displayName: 'Install dependencies'

- script: |
flake8 bashplot/ --count --max-line-length=88 --ignore=W293,W291 --statistic
flake8 bashplot/ --count --statistic
black . --check -v
isort . --check -v
flake8 . --count --exit-zero --max-complexity=10 --statistics
Expand All @@ -44,7 +44,7 @@ steps:
displayName: 'Install bashplot'

- script: |
coverage run -m pytest test/test*.py -vv
coverage run -m pytest -vv
coverage report -m
coverage xml
displayName: 'pytest'
2 changes: 1 addition & 1 deletion bashplot/bashplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def plot_plot(fig, x, Y, label):
def plot_scatter(fig, x, Y, label):
"""Make the scatter-figures.

plot_scatter() is generating a single- or multi-plot by recursiving calling
plot_scatter() is generating a single- or multi-plot by recursive calling
scatter().

Parameters
Expand Down
17 changes: 17 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[flake8]
max-line-length = 88
extend-ignore = E203, W503, W293, W291

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88

[pylint]
max-line-length = 88

[pylint.messages_control]
disable = C0330, C0326
45 changes: 39 additions & 6 deletions test/test_bashplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from unittest import mock

import pytest
import sample_generator

from bashplot import bashplot
Expand All @@ -11,8 +12,8 @@

print()

test_txt = Path.cwd().glob("test*.txt")
test_dat = Path.cwd().glob("test*.dat")
test_txt = list(Path.cwd().glob("test*.txt"))
test_dat = list(Path.cwd().glob("test*.dat"))

args_1 = {
"infile": test_txt,
Expand Down Expand Up @@ -103,24 +104,56 @@ def test_usecols():


@mock.patch("bashplot.bashplot.bashplot")
def test_default_run(bashplot):
def test_default_run_mock(bashplot):
bashplot.bashplot(fnames=test_txt, args=args_1)
assert bashplot.bashplot.is_called


def test_default_run():
bashplot.bashplot(fnames=test_txt, args=args_1)
assert True


@mock.patch("bashplot.bashplot.bashplot")
def test_customize_run_1(bashplot):
def test_customize_run_mock_1(bashplot):
bashplot.bashplot(fnames=test_txt, args=args_2)
assert bashplot.bashplot.is_called


def test_customize_run_1():
bashplot.bashplot(fnames=test_txt, args=args_2)
assert True


@mock.patch("bashplot.bashplot.bashplot")
def test_customize_run_2(bashplot):
def test_customize_run_mock_2(bashplot):
bashplot.bashplot(fnames=test_dat, args=args_3)
assert bashplot.bashplot.is_called


def test_customize_run_2():
bashplot.bashplot(fnames=test_dat, args=args_3)
assert True


@mock.patch("bashplot.bashplot.command_line_runner")
def test_command_line(command_line_runner):
def test_command_line_mock(command_line_runner):
bashplot.command_line_runner()
assert bashplot.command_line_runner.is_called


def test_command_line_1():
bashplot.command_line_runner()
assert True


def test_log(capfd):
bashplot.log("msg")
out, _ = capfd.readouterr()
assert out == "msg\n"


def test_log_error(capfd):
bashplot.log("msg", mode=True)
out, _ = capfd.readouterr()
assert out == "[ERROR] msg\n"