Permalink
Browse files

Changes to Travis CI test coverage and linter (#299)

  • Loading branch information...
joachimmetz committed Dec 15, 2018
1 parent 1e4f104 commit af810e21c713c4467e920f274fc6c727336af173
@@ -26,7 +26,7 @@ jobs=1

# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
load-plugins=pylint.extensions.docparams

# Pickle collected data for later comparisons.
persistent=yes
@@ -67,6 +67,7 @@ disable=
useless-suppression,
deprecated-pragma,
no-absolute-import,
missing-param-doc,
metaclass-assignment,
eq-without-hash,
fixme,
@@ -1,45 +1,99 @@
language: python
virtualenv:
system_site_packages: true
matrix:
include:
- env: TARGET="pylint"
os: linux
dist: trusty
sudo: required
group: edge
language: python
python: 2.7
virtualenv:
system_site_packages: true
- env: TARGET="linux-python27"
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
language: python
python: 2.7
- env: TARGET="linux-python34"
virtualenv:
system_site_packages: true
- env: TARGET="linux-python35"
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
python: 3.4
language: python
python: 3.5
virtualenv:
system_site_packages: true
- env: [TARGET="linux-python27-tox", TOXENV="py27"]
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
language: python
python: 2.7
virtualenv:
system_site_packages: false
- env: [TARGET="linux-python34-tox", TOXENV="py34"]
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
language: python
python: 3.4
virtualenv:
system_site_packages: false
- env: [TARGET="linux-python35-tox", TOXENV="py35"]
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 3.5
virtualenv:
system_site_packages: false
- env: [TARGET="linux-python36-tox", TOXENV="py36"]
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 3.6
virtualenv:
system_site_packages: false
- env: [TARGET="linux-python37-tox", TOXENV="py37"]
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 3.7
virtualenv:
system_site_packages: false
- env: [TARGET="macos-python27", PYTHONPATH="/Library/Python/2.7/site-packages/"]
os: osx
osx_image: xcode9.2
language: generic
allow_failures:
- env: TARGET="linux-python34"
- env: [TARGET="macos-python27", PYTHONPATH="/Library/Python/2.7/site-packages/"]
- env: TARGET="trusty-python27"
os: linux
dist: trusty
sudo: required
group: edge
language: python
python: 2.7
virtualenv:
system_site_packages: true
- env: TARGET="trusty-python34"
os: linux
dist: trusty
sudo: required
group: edge
language: python
python: 3.4
virtualenv:
system_site_packages: true
install:
- ./config/travis/install.sh
script:
@@ -1,26 +1,34 @@
environment:
matrix:
- TARGET: python27
- TARGET: windows_python27
MACHINE_TYPE: "x86"
PYTHON: "C:\\Python27"
- TARGET: python36
- TARGET: windows_python27
MACHINE_TYPE: "amd64"
PYTHON: "C:\\Python27-x64"
- TARGET: windows_python36
MACHINE_TYPE: "x86"
PYTHON: "C:\\Python36"
- TARGET: windows_python36
MACHINE_TYPE: "amd64"
PYTHON: "C:\\Python36-x64"

install:
- cmd: '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /release'
- cmd: "%PYTHON%\\python.exe -m pip install --upgrade pip"
- cmd: "%PYTHON%\\Scripts\\pip.exe install pywin32 WMI"
- cmd: "%PYTHON%\\python.exe -m pip install pywin32 WMI"
- cmd: "%PYTHON%\\python.exe %PYTHON%\\Scripts\\pywin32_postinstall.py -install"
- cmd: git clone https://github.com/log2timeline/l2tdevtools.git ..\l2tdevtools
- cmd: if [%TARGET%]==[python27] (
- cmd: if [%TARGET%]==[windows_python27] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type x86 --msi-targetdir "%PYTHON%" --track dev PyYAML funcsigs mock pbr six yapf )
- cmd: if [%TARGET%]==[python36] (
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type %MACHINE_TYPE% --msi-targetdir "%PYTHON%" --track dev PyYAML funcsigs mock pbr six yapf )
- cmd: if [%TARGET%]==[windows_python36] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type x86 --msi-targetdir "%PYTHON%" --track dev PyYAML funcsigs mock pbr six yapf )
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type %MACHINE_TYPE% --msi-targetdir "%PYTHON%" --track dev PyYAML mock pbr six )

build: off

test_script:
- "%PYTHON%\\python.exe run_tests.py"
- cmd: "%PYTHON%\\python.exe run_tests.py"
@@ -1,5 +1,6 @@
[project]
name: artifacts
status: alpha
name_description: ForensicArtifacts.com Artifact Repository
maintainer: Forensic artifacts <forensicartifacts@googlegroups.com>
homepage_url: https://github.com/ForensicArtifacts/artifacts
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""ForensicArtifacts.com Artifact Repository."""

__version__ = '20181213'
__version__ = '20181214'
@@ -22,6 +22,10 @@ class BaseArtifactsReader(object):
supported_os (set[str]): supported operating systems.
"""

# Note that redundant-returns-doc and redundant-yields-doc are broken for
# pylint 1.7.x for abstract methods.
# pylint: disable=redundant-returns-doc,redundant-yields-doc

def __init__(self):
"""Initializes an artifacts reader."""
super(BaseArtifactsReader, self).__init__()
@@ -88,6 +92,10 @@ def ReadFileObject(self, file_object):
class ArtifactsReader(BaseArtifactsReader):
"""Artifacts reader common functionality."""

# Note that redundant-yields-doc is broken for pylint 1.7.x for
# abstract methods.
# pylint: disable=redundant-yields-doc

def __init__(self):
"""Initializes an artifacts reader."""
super(ArtifactsReader, self).__init__()
@@ -101,6 +109,7 @@ def _ReadLabels(self, artifact_definition_values, artifact_definition, name):
artifact_definition_values (dict[str, object]): artifact definition
values.
artifact_definition (ArtifactDefinition): an artifact definition.
name (str): name of the artifact definition.
Raises:
FormatError: if there are undefined labels.
@@ -115,6 +124,9 @@ def _ReadLabels(self, artifact_definition_values, artifact_definition, name):

artifact_definition.labels = labels

# Pylint fails on detecting the type of definition_object based on
# the docstring.
# pylint: disable=missing-type-doc
def _ReadSupportedOS(self, definition_values, definition_object, name):
"""Reads the optional artifact or source type supported OS.
@@ -147,6 +159,7 @@ def _ReadSources(self, artifact_definition_values, artifact_definition, name):
artifact_definition_values (dict[str, object]): artifact definition
values.
artifact_definition (ArtifactDefinition): an artifact definition.
name (str): name of the artifact definition.
Raises:
FormatError: if the type indicator is not set or unsupported,
@@ -180,7 +180,7 @@ def RegisterSourceTypes(cls, source_type_classes):
for source_type_class in source_type_classes:
cls.RegisterSourceType(source_type_class)

def ReadFromDirectory(self, artifact_reader, path, extension='yaml'):
def ReadFromDirectory(self, artifacts_reader, path, extension='yaml'):
"""Reads artifact definitions into the registry from files in a directory.
This function does not recurse sub directories.
@@ -193,26 +193,26 @@ def ReadFromDirectory(self, artifact_reader, path, extension='yaml'):
Raises:
KeyError: if a duplicate artifact definition is encountered.
"""
for artifact_definition in artifact_reader.ReadDirectory(
for artifact_definition in artifacts_reader.ReadDirectory(
path, extension=extension):
self.RegisterDefinition(artifact_definition)

def ReadFromFile(self, artifact_reader, filename):
def ReadFromFile(self, artifacts_reader, filename):
"""Reads artifact definitions into the registry from a file.
Args:
artifacts_reader (ArtifactsReader): an artifacts reader.
filename (str): name of the file to read from.
"""
for artifact_definition in artifact_reader.ReadFile(filename):
for artifact_definition in artifacts_reader.ReadFile(filename):
self.RegisterDefinition(artifact_definition)

def ReadFileObject(self, artifact_reader, file_object):
def ReadFileObject(self, artifacts_reader, file_object):
"""Reads artifact definitions into the registry from a file-like object.
Args:
artifacts_reader (ArtifactsReader): an artifacts reader.
file_object (file): file-like object to read from.
"""
for artifact_definition in artifact_reader.ReadFileObject(file_object):
for artifact_definition in artifacts_reader.ReadFileObject(file_object):
self.RegisterDefinition(artifact_definition)
@@ -30,17 +30,26 @@
class SourceType(object):
"""Artifact definition source type interface."""

# Note that redundant-returns-doc is broken for pylint 1.7.x for
# abstract methods.
# pylint: disable=redundant-returns-doc

TYPE_INDICATOR = None

@property
def type_indicator(self):
"""The type indicator.
def __init__(self):
"""Initializes an artifact definition source type.
Raises:
NotImplementedError: if the type indicator is not defined.
FormatError: if the indicator is not defined.
"""
super(SourceType, self).__init__()

if not self.TYPE_INDICATOR:
raise NotImplementedError('Invalid source type missing type indicator.')
raise errors.FormatError('Missing type indicator.')

@property
def type_indicator(self):
"""str: type indicator."""
return self.TYPE_INDICATOR

@abc.abstractmethod
@@ -333,14 +342,20 @@ def AsDict(self):


class WMIQuerySourceType(SourceType):
"""WMI query source type."""
"""WMI query source type.
Attributes:
base_object (str): WMI base object.
query (str): WMI query.
"""

TYPE_INDICATOR = definitions.TYPE_INDICATOR_WMI_QUERY

def __init__(self, query=None, base_object=None):
def __init__(self, base_object=None, query=None):
"""Initializes a source type.
Args:
base_object (Optional[str]): WMI base object.
query (Optional[str]): WMI query.
Raises:
@@ -11,6 +11,10 @@
class BaseArtifactsWriter(object):
"""Artifacts writer interface."""

# Note that redundant-returns-doc is broken for # pylint 1.7.x for
# abstract methods.
# pylint: disable=redundant-returns-doc

@abc.abstractmethod
def FormatArtifacts(self, artifacts):
"""Formats artifacts to desired output format.
@@ -35,6 +39,10 @@ def WriteArtifactsFile(self, artifacts, filename):
class ArtifactWriter(BaseArtifactsWriter):
"""File artifacts writer."""

# Note that redundant-returns-doc is broken for # pylint 1.7.x for
# abstract methods.
# pylint: disable=redundant-returns-doc

@abc.abstractmethod
def FormatArtifacts(self, artifacts):
"""Formats artifacts to desired output format.
@@ -1,5 +1,5 @@
artifacts (20181213-1) unstable; urgency=low
artifacts (20181214-1) unstable; urgency=low

* Auto-generated

-- Forensic artifacts <forensicartifacts@googlegroups.com> Thu, 13 Dec 2018 08:11:50 +0100
-- Forensic artifacts <forensicartifacts@googlegroups.com> Fri, 14 Dec 2018 18:39:02 +0100
@@ -11,11 +11,11 @@ L2TBINARIES_TEST_DEPENDENCIES="funcsigs mock pbr six yapf";

PYTHON2_DEPENDENCIES="python-yaml";

PYTHON2_TEST_DEPENDENCIES="python-coverage python-mock python-tox python-yapf yapf";
PYTHON2_TEST_DEPENDENCIES="python-coverage python-funcsigs python-mock python-pbr python-six python-tox python-yapf yapf";

PYTHON3_DEPENDENCIES="python3-yaml";

PYTHON3_TEST_DEPENDENCIES="python-yapf python3-mock python3-setuptools python3-tox yapf";
PYTHON3_TEST_DEPENDENCIES="python-yapf python3-mock python3-pbr python3-setuptools python3-six python3-tox yapf";

# Exit on error.
set -e;
@@ -46,6 +46,14 @@ elif test ${TRAVIS_OS_NAME} = "linux" && test ${TARGET} != "jenkins";
then
sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3-source.list;

if test ${TARGET} = "pylint";
then
if test ${TRAVIS_PYTHON_VERSION} = "2.7";
then
sudo add-apt-repository ppa:gift/pylint2 -y;
fi
fi

sudo add-apt-repository ppa:gift/dev -y;
sudo apt-get update -q;

Oops, something went wrong.

0 comments on commit af810e2

Please sign in to comment.