Skip to content

Commit

Permalink
Improve .coafile rules using inheritance
Browse files Browse the repository at this point in the history
Fix linting where appropriate.

Change-Id: Ife5f944bd3819858486d323ed91a80df7f075d88
Signed-off-by: Thanh Ha <[email protected]>
  • Loading branch information
zxiiro committed Jul 28, 2017
1 parent 7d945e8 commit 6109492
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
21 changes: 15 additions & 6 deletions .coafile
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
[Git]
[all]
ignore = .tox/**,
.git/**,
.gitignore,
.gitreview,
.gitmodules,
node_modules/**

[all.Git]
bears = GitCommitBear
ignore_length_regex = Signed-off-by,
Also-by,
Co-authored-by,
http://,
https://

[Documentation]
[all.Documentation]
bears = WriteGoodLintBear
files = docs/**/*.rst

[Python]
[all.Python]
bears = BanditBear,
PEP8Bear,
PyCommentedCodeBear,
PyDocStyleBear,
PyFlakesBear,
PyImportSortBear
files = lftools/**/*.py
files = **.py
ignore += docs/conf.py
known_first_party_imports = lftools
known_third_party_imports = pytest, six
pydocstyle_ignore = D203, D213, D301
max_line_length = 120

[Shell]
[all.Shell]
bears = ShellCheckBear,
SpaceConsistencyBear
files = shell/*
files = **.sh, shell/*
shell = bash
indent_size = 4
use_spaces = yeah
12 changes: 12 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
"""Setup.py."""

from setuptools import find_packages
from setuptools import setup

Expand Down
13 changes: 7 additions & 6 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
"""Unit tests for the version command."""

import difflib
from distutils import dir_util
import filecmp
import os

import click
import pytest

from lftools import cli


FIXTURE_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'fixtures',
Expand All @@ -30,23 +27,27 @@
os.path.join(FIXTURE_DIR, 'version_bump'),
)
def test_version_bump(cli_runner, datafiles):
"""Test version bump command."""
os.chdir(str(datafiles))
result = cli_runner.invoke(cli.cli, ['version', 'bump', 'TestRelease'])
cli_runner.invoke(cli.cli, ['version', 'bump', 'TestRelease'])

for _file in datafiles.listdir():
pom = str(_file) + '/pom.xml'
expected_pom = str(_file) + '/pom.xml.expected'
# noqa: B101 .
assert filecmp.cmp(pom, expected_pom)


@pytest.mark.datafiles(
os.path.join(FIXTURE_DIR, 'version_release'),
)
def test_version_release(cli_runner, datafiles):
"""Test version release command."""
os.chdir(str(datafiles))
result = cli_runner.invoke(cli.cli, ['version', 'release', 'TestRelease'])
cli_runner.invoke(cli.cli, ['version', 'release', 'TestRelease'])

for _file in datafiles.listdir():
pom = str(_file) + '/pom.xml'
expected_pom = str(_file) + '/pom.xml.expected'
# noqa: B101 .
assert filecmp.cmp(pom, expected_pom)

0 comments on commit 6109492

Please sign in to comment.