Skip to content

Commit

Permalink
Merge pull request #37 from capitalone/dev
Browse files Browse the repository at this point in the history
Release 2022.6.0
  • Loading branch information
Faisal authored Jun 23, 2022
2 parents aef12ab + fdde109 commit 9932944
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ repos:
types: [file, python]
language_version: python3.9
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.5.4
rev: v5.10.1
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 3.8.3
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings]
files: ^edgetest/
language_version: python3.9
- repo: https://github.com/jazzband/pip-tools
rev: 5.5.0
rev: 6.6.2
hooks:
- id: pip-compile
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.2.0
hooks:
- id: trailing-whitespace
- id: debug-statements
Expand Down
12 changes: 0 additions & 12 deletions .whitesource

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
author = "Akshay Gupta"

# The short X.Y version
version = "2022.4.0"
version = "2022.6.0"
# The full version, including alpha/beta/rc tags
release = ""

Expand Down
2 changes: 1 addition & 1 deletion edgetest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Package initialization."""


__version__ = "2022.4.0"
__version__ = "2022.6.0"

__title__ = "edgetest"
__description__ = "Bleeding edge dependency testing"
Expand Down
12 changes: 10 additions & 2 deletions edgetest/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,33 @@

from .core import TestPackage

VALID_OUTPUTS = ["rst", "github"]

def gen_report(testers: List[TestPackage]) -> Any:

def gen_report(testers: List[TestPackage], output_type: str = "rst") -> Any:
"""Generate a rST report.
Parameters
----------
testers : list
A list of ``TestPackage`` objects.
output_type : str
A valid output type of ``rst`` or ``github``
Returns
-------
Any
The report.
"""
if output_type not in VALID_OUTPUTS:
raise ValueError(f"Invalid output_type provided: {output_type}")

headers = ["Environment", "Passing tests", "Upgraded packages", "Package version"]
rows: List[List] = []
for env in testers:
upgraded = env.upgraded_packages()
for pkg in upgraded:
rows.append([env.envname, env.status, pkg["name"], pkg["version"]])

return tabulate(rows, headers=headers, tablefmt="rst")
return tabulate(rows, headers=headers, tablefmt=output_type)
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#
cerberus==1.3.4
# via edgetest (setup.cfg)
click==8.1.2
click==8.1.3
# via edgetest (setup.cfg)
packaging==21.3
# via edgetest (setup.cfg)
pluggy==1.0.0
# via edgetest (setup.cfg)
pyparsing==3.0.8
pyparsing==3.0.9
# via packaging
tabulate==0.8.9
# via edgetest (setup.cfg)
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include_package_data = True
packages = find:
install_requires =
Cerberus<=1.3.4,>=1.3.0
click<=8.1.2,>=7.0
click<=8.1.3,>=7.0
pluggy<=1.0.0,>=1.0.0
tabulate<=0.8.9,>=0.8.9
packaging<=21.3,>20.6
Expand Down Expand Up @@ -98,7 +98,7 @@ console_scripts =
edgetest = edgetest.interface:cli

[bumpver]
current_version = "2022.3.1"
current_version = "2022.6.0"
version_pattern = "YYYY.MM.INC0"
commit_message = "Bump {old_version} to {new_version}"
commit = True
Expand Down
43 changes: 43 additions & 0 deletions tests/test_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from unittest.mock import patch

import pytest

from edgetest.core import TestPackage
from edgetest.report import gen_report


@patch("edgetest.report.tabulate", autospec=True)
@patch("edgetest.core.TestPackage.upgraded_packages", autospec=True)
def test_report(mock_test_package, mock_tabulate, plugin_manager):
"""Test gen_report function"""

tester_list = [
TestPackage(hook=plugin_manager.hook, envname="myenv", upgrade=["myupgrade1"]),
TestPackage(hook=plugin_manager.hook, envname="myenv", upgrade=["myupgrade2"]),
]
gen_report(tester_list)
mock_tabulate.assert_called_with(
[],
headers=[
"Environment",
"Passing tests",
"Upgraded packages",
"Package version",
],
tablefmt="rst",
)

gen_report(tester_list, output_type="github")
mock_tabulate.assert_called_with(
[],
headers=[
"Environment",
"Passing tests",
"Upgraded packages",
"Package version",
],
tablefmt="github",
)

with pytest.raises(ValueError) as e:
gen_report(tester_list, output_type="bad")

0 comments on commit 9932944

Please sign in to comment.