Skip to content

Commit

Permalink
Merge 3ce7fac into 246a48e
Browse files Browse the repository at this point in the history
  • Loading branch information
ansasaki committed Aug 5, 2019
2 parents 246a48e + 3ce7fac commit 4fd64da
Show file tree
Hide file tree
Showing 24 changed files with 189 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.3.1
current_version = 0.3.2
commit = True
tag = True

Expand Down
8 changes: 8 additions & 0 deletions .travis.yml
Expand Up @@ -34,6 +34,14 @@ matrix:
- python: '3.6'
env:
- TOXENV=3.6-nocov
- python: '3.7'
dist: xenial
env:
- TOXENV=3.7-cover,report,coveralls,codecov
- python: '3.7'
dist: xenial
env:
- TOXENV=3.7-nocov
- python: 'pypy-5.4'
env:
- TOXENV=pypy-cover,report,coveralls,codecov
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -2,6 +2,14 @@
Changelog
=========

0.3.2 (2019-08-05)
------------------

* Fixed broken builds due to changes in warning output
* Changed tests to check error messages
* Added python 3.7 to testing matrix
* Added requirement to verify SNI when checking URLs in docs

0.3.1 (2018-08-20)
------------------

Expand Down
8 changes: 8 additions & 0 deletions HISTORY.rst
Expand Up @@ -2,6 +2,14 @@
History
=======

0.3.2 (2019-08-05)
------------------

* Fixed broken builds due to changes in warning output
* Changed tests to check error messages
* Added python 3.7 to testing matrix
* Added requirement to verify SNI when checking URLs in docs

0.3.1 (2018-08-20)
------------------

Expand Down
7 changes: 5 additions & 2 deletions ci/templates/.travis.yml
Expand Up @@ -12,9 +12,12 @@ matrix:
include:
{%- for env, config in tox_environments|dictsort %}{{ '' }}
- python: '{{ '{0[0]}-5.4'.format(env.split('-')) if env.startswith('pypy') else env.split('-')[0] }}'
{% if not env.startswith('pypy') and env.split('-')[0] >= "3.7" %}
dist: xenial
{% endif %}
env:
- TOXENV={{ env }}{% if "true" in config.cover %},report,coveralls,codecov{% endif -%}
{% endfor %}
- TOXENV={{ env }}{% if "true" in config.cover %},report,coveralls,codecov{% endif %}
{%- endfor %}

before_install:
- python --version
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -28,7 +28,7 @@
year = '2018'
author = u'Anderson Toshiyuki Sasaki <ansasaki@redhat.com>'
copyright = '{0}, {1}'.format(year, author)
version = release = u'0.3.1'
version = release = u'0.3.2'

pygments_style = 'trac'
templates_path = ['.']
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
@@ -1,3 +1,4 @@
sphinx>=1.3
sphinx-rtd-theme
requests[security]
-e .
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -70,6 +70,7 @@ python_versions =
3.4
3.5
3.6
3.7
pypy

coverage_flags =
Expand Down
2 changes: 1 addition & 1 deletion src/abimap/_version.py
@@ -1 +1 @@
__version__ = '0.3.1'
__version__ = '0.3.2'
6 changes: 3 additions & 3 deletions src/abimap/symver.py
Expand Up @@ -970,9 +970,9 @@ def clean_symbols(symbols):
duplicates.add(previous)
previous = i
if duplicates:
dup_list = "".join((" " * 4 + dup + "\n" for dup in
dup_list = "".join((dup + ", " for dup in
sorted(duplicates)))
logger.warning("Duplicated symbols provided:\n%s", dup_list)
logger.warning("Duplicated symbols provided: %s", dup_list)

return clean

Expand Down Expand Up @@ -1009,7 +1009,7 @@ def check_files(out_arg, out_name, in_arg, in_name, dry):
# preserve the content
shutil.copy2(str(in_name), str(in_name) + ".old")
except Exception as e:
logger.error("Could no copy \'%s\' to \'%s.old\'."
logger.error("Could not copy \'%s\' to \'%s.old\'."
" Aborting.", str(in_name), str(in_name))
raise e

Expand Down
62 changes: 58 additions & 4 deletions tests/conftest.py
@@ -1,5 +1,6 @@
import filecmp
import os
import re
from distutils import dir_util

import pytest
Expand Down Expand Up @@ -56,7 +57,8 @@ def testcases(datadir, capsys):
if file_type.lower() == ".yml" or file_type.lower() == ".yaml":
with open(str(test_input), 'r') as stream:
try:
all_tests.extend(yaml.load(stream))
all_tests.extend(yaml.load(stream,
Loader=yaml.FullLoader))
except yaml.YAMLError as e:
with capsys.disabled():
print(e)
Expand Down Expand Up @@ -87,6 +89,50 @@ def __exit__(self, etype, value, traceback):
os.chdir(self.saved_path)


def is_warning_in_log(expected, log):
"""
Search for a warning containing the expected message in the log. Returns
True if found; False otherwise.
:param expected: The regular expression
"param log: The input string
"""

# Escape possibly existing special characters
escaped = re.escape(expected)

regex = "WARNING.*" + escaped

to_match = re.compile(regex)
found = to_match.search(log)
if found:
return True

return False


def is_error_in_log(expected, log):
"""
Search for an error containing the expected message in the log. Returns
True if found; False otherwise.
:param expected: The regular expression
"param log: The input string
"""

# Escape possibly existing special characters
escaped = re.escape(expected)

regex = "ERROR.*" + escaped

to_match = re.compile(regex)
found = to_match.search(log)
if found:
return True

return False


def run_tc(tc, datadir, capsys, caplog):
"""
Run a command test case (for update and new commands)
Expand Down Expand Up @@ -166,10 +212,15 @@ class C(object):
# Fail
assert 0

# Check if the expected messages are in the log
# Check if the expected warning messages are in the log
if tc_out["warnings"]:
for expected in tc_out["warnings"]:
assert expected in caplog.text
assert is_warning_in_log(expected, caplog.text)

# Check if the expected error messages are in the log
if tc_out["errors"]:
for expected in tc_out["errors"]:
assert is_error_in_log(expected, caplog.text)

# If a log file was supposed to exist, check the content
if args.logfile:
Expand All @@ -178,7 +229,10 @@ class C(object):
logged = log.read()
if tc_out["warnings"]:
for expected in tc_out["warnings"]:
assert expected in logged
assert is_warning_in_log(expected, caplog.text)
if tc_out["errors"]:
for expected in tc_out["errors"]:
assert is_error_in_log(expected, caplog.text)
if tc_out["exceptions"]:
for expected in tc_out["exceptions"]:
assert expected in logged
Expand Down
6 changes: 6 additions & 0 deletions tests/data_template/test_new/guess_names.yaml
Expand Up @@ -10,6 +10,7 @@
file:
stdout: "separated.stdout"
warnings:
errors:
exceptions:
-
input:
Expand All @@ -21,6 +22,7 @@
file:
stdout: "given_release.stdout"
warnings:
errors:
exceptions:
-
input:
Expand All @@ -33,6 +35,7 @@
file:
stdout: "release_and_version.stdout"
warnings:
errors:
exceptions:
-
input:
Expand All @@ -47,6 +50,7 @@
file:
stdout: "release_and_name.stdout"
warnings:
errors:
exceptions:
-
input:
Expand All @@ -61,5 +65,7 @@
- "Release provided is not well formed (a well formed release contain
the library identifier and the version information). \
Suggested: something like LIBNAME_1_2_3"
errors:
- "Please provide the release name."
exceptions:
- "Please provide the release name."
13 changes: 12 additions & 1 deletion tests/data_template/test_new/options.yaml
Expand Up @@ -10,6 +10,7 @@
file:
stdout: "sanity.stdout"
warnings:
errors:
exceptions:
-
input:
Expand All @@ -23,6 +24,7 @@
file:
stdout: "sanity_final.stdout"
warnings:
errors:
exceptions:
-
input:
Expand All @@ -37,6 +39,7 @@
file: "with_out.outfile"
stdout: ""
warnings:
errors:
exceptions:
-
input:
Expand All @@ -56,6 +59,7 @@
- "Overwriting existing file 'overwrite.in'"
- "Given paths in '--out' and '--in' are the same."
- "Moving 'overwrite.in' to 'overwrite.in.old'."
errors:
exceptions:
-
input:
Expand All @@ -75,6 +79,7 @@
warnings:
- "Overwriting existing file 'dry.in'"
- "Given paths in '--out' and '--in' are the same."
errors:
exceptions:
-
input:
Expand All @@ -90,6 +95,7 @@
stdout:
warnings:
- "No valid symbols provided. Nothing done."
errors:
exceptions:
-
input:
Expand All @@ -105,6 +111,8 @@
- "Release provided is not well formed (a well formed release contain \
the library identifier and the version information). \
Suggested: something like LIBNAME_1_2_3"
errors:
- "Please provide the release name."
exceptions:
- "Please provide the release name."
-
Expand All @@ -116,6 +124,8 @@
file:
stdout:
warnings:
errors:
- "It is necessary to provide either release name or name and version"
exceptions:
- "It is necessary to provide either release name or name and version"
-
Expand All @@ -129,5 +139,6 @@
file:
stdout: "duplicated_input.stdout"
warnings:
- "Duplicated symbols provided:\n a\n b\n\n"
- "Duplicated symbols provided: a, b"
errors:
exceptions:
Expand Up @@ -16,7 +16,8 @@
- "Overwriting existing file 'overwrite_protected.in'"
- "Given paths in '--out' and '--in' are the same."
- "Moving 'overwrite_protected.in' to 'overwrite_protected.in.old'."
- "Could no copy 'overwrite_protected.in' to \
errors:
- "Could not copy 'overwrite_protected.in' to \
'overwrite_protected.in.old'. Aborting."
exceptions:
- "Permission denied: 'overwrite_protected.in.old'"
Expand Down

0 comments on commit 4fd64da

Please sign in to comment.