Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support continuous integration #3

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
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
55 changes: 53 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# IntelliJ project files
.idea
*.iml
out

.pytest_cache/**
.eggs/**
*.egg-info/**
**/.pytest_cache/**
**/__pycache__/**
fmfexporter.log
.idea
**/.pyc
venv
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
sudo: false
language: python
python:
- "3.6"
#- "3.7-dev"

install:
- pip install wheel codecov coverage tox-travis
- python setup.py bdist_wheel
- pip install ./dist/fmfexporter-*.whl

stages:
- name: tests
- name: deploy

jobs:
fast_finish: true
include:
- stage: tests
script: tox
after_script:
- codecov
- stage: deploy
name: "Deploy fmfexporter to Test PyPi"
python: 3.6
install: true
script: skip
after_success: true
deploy:
- provider: pypi
user: rh-messaging-qe
server: https://testpypi.python.org/pypi
password:
secure: "TFxPZnl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pIS/CytTlWxPUsI5rbnznoyCxiqmE4S7QBex/Pp6ZcE14oZD6YYPS1cbzYy/JU0QpLrruqcDyklOIjRYeDASZFbwhBX9gvB+Ve9G9SlPmDzrITPxQiGh0ud/1UkQZl/j3WuQ2hiXIpvMOVK0DBb0uMWEKd9iAQcSFMKE/v+bO4reIx3fSXQ+W4zAc2EWDknusesnK9fFH1nJZl53Zv9qY3nGuh3xqnY0FZl77prnhRNR/HXzFVGvL/gHnzNzSWhrxxdPkIHcMFGu0wpWxFzxbIWTLduFPsR+GCOn/8277JSjf1dcl8UDhhlVQ5XeLSDst52/lIw+yo59g0ResRYVROF4k="
distributions: bdist_wheel
on:
branch: master
tags: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ upload:

clean:
python setup.py clean
rm -rf build dist fmfexporter.egg-info .eggs
rm -rf build dist fmfexporter.egg-info .eggs .tox
find . -type f -name "*.py[co]" -delete
find . -type d -name "__pycache__" -delete
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# fmfexporter

[![Build Status](https://img.shields.io/travis/rh-messaging-qe/fmfexporter.svg?style=for-the-badge)](https://travis-ci.org/rh-messaging-qe/fmfexporter)
[![Code coverage](https://img.shields.io/codecov/c/github/rh-messaging-qe/fmfexporter.svg?style=for-the-badge)](https://codecov.io/gh/rh-messaging-qe/fmfexporter)

FMF (Flexible Metadata Format) test case exporter tool.

This tool can be used to convert and export Test Cases defined
Expand All @@ -13,7 +16,7 @@ Format for defining the test case is YAML (Simple example available -- *WIP* --

## Pre-requisites

* python 3.6+
* Python 3.6+
* recommended to install fmfexporter or its requirements in a virtualenv

## Usage
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[aliases]
test = pytest

[tool:pytest]
addopts = -s -vvv
python_files = test/*.py
python_files = tests/*.py
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
install_requires=['fmf', 'requests', 'urllib3'],
setup_requires=['pytest-runner', 'fmf', 'requests', 'urllib3'],
tests_require=['pytest'],
author="Fernando Giorgetti, Dominik Lenoch",
author_email="fgiorget@redhatcom, [email protected]",
author='Fernando Giorgetti, Dominik Lenoch',
author_email='fgiorget@redhatcom, [email protected]',
license="Apache-2.0",
description="Flexible Metadata Format test-case exporter tool",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/rhmessagingqe/fmfexporter",
packages=setuptools.find_packages(),
packages=setuptools.find_packages(where="src"),
package_dir={'': 'src'},
provides=['fmfexporter'],
classifiers=[
"Programming Language :: Python :: 3.6",
Expand Down
2 changes: 2 additions & 0 deletions fmfexporter/__init__.py → src/fmfexporter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from fmfexporter.fmf_testcase import FMFTestCase
from fmfexporter.fmf_adapter import FMFAdapter

__all__ = ['FMFTestCase', 'FMFAdapter']
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
# All concrete adapters should be imported here, otherwise they
# won't be recognized as subclasses of FMFAdapter (__subclasses__()).
#
from fmfexporter.adapters.polarion.fmf_adapter_polarion import *
from fmfexporter.adapters.polarion.fmf_adapter_polarion import FMFAdapterPolarion

__all__ = ['FMFAdapterPolarion']
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

from fmfexporter.adapters.polarion.utils.polarion_config import PolarionConfig
from fmfexporter.fmf_adapter import FMFAdapterArgParser

"""
Argument parser for the FMF Polarion Adapter.
"""


class PolarionArgParser(FMFAdapterArgParser):
"""
Argument parser that is used when polarion adapter is selected.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fmfexporter import FMFTestCase
import re
import xml.etree.ElementTree as etree
import xml.etree.ElementTree as ElTree
from xml.dom import minidom

from fmfexporter.adapters.polarion.utils.polarion_xml import PolarionXmlUtils
Expand All @@ -16,7 +16,7 @@ class PolarionTestCase(object):
"""
# Used to define file name for test case based on
# classname.name (keeping just characters, numbers and dot)
RE_FILE_NAME = re.compile(r'[^A-Za-z0-9_\.]')
RE_FILE_NAME = re.compile(r'[^A-Za-z0-9_.]')

#
# Regular expression used to match user part of an e-mail address
Expand Down Expand Up @@ -172,18 +172,18 @@ def to_xml(self):
on current state of this instance.
:return: str representing the test case xml
"""
xmltree = etree.ElementTree(element=etree.Element('testcases'))
xmltree = ElTree.ElementTree(element=ElTree.Element('testcases'))

# root element - testcases and attributes
xmlroot = xmltree.getroot()
xmlroot.attrib['project-id'] = self.project

# properties
properties = etree.SubElement(xmlroot, 'properties')
properties = ElTree.SubElement(xmlroot, 'properties')
PolarionXmlUtils.new_property_sub_element(properties, 'lookup-method', self.lookup_method)

# testcase and attributes
tc = etree.SubElement(xmlroot, 'testcase')
tc = ElTree.SubElement(xmlroot, 'testcase')
tc.set('assignee-id', self.assignee)
if self.approvals:
tc.set('approver-ids', ",".join([ap + ":approved" for ap in self.approvals]))
Expand All @@ -192,11 +192,11 @@ def to_xml(self):

# testcase child elements
# testcase/title
tc_title = etree.SubElement(tc, 'title')
tc_title = ElTree.SubElement(tc, 'title')
tc_title.text = self.title

# testcase/description
tc_description = etree.SubElement(tc, 'description')
tc_description = ElTree.SubElement(tc, 'description')
tc_description.text = PolarionTestCase.DESC_PREFIX_SUFFIX
if self.description:
tc_description.text += "<br>"
Expand All @@ -205,7 +205,7 @@ def to_xml(self):
tc_description.text += PolarionTestCase.DESC_PREFIX_SUFFIX

# testcase/custom-fields
tc_custom = etree.SubElement(tc, 'custom-fields')
tc_custom = ElTree.SubElement(tc, 'custom-fields')
PolarionXmlUtils.new_custom_field(tc_custom, 'casecomponent', self.component)
PolarionXmlUtils.new_custom_field(tc_custom, 'subcomponent', self.sub_component)
PolarionXmlUtils.new_custom_field(tc_custom, 'testtype', self.type)
Expand All @@ -218,15 +218,17 @@ def to_xml(self):

# testcase/linked-work-items
if self.verifies:
tc_linked = etree.SubElement(tc, 'linked-work-items')
for verify in [verify for verify in self.verifies if isinstance(verify, dict)]:
PolarionXmlUtils.new_linked_work_item(tc_linked,
verify.get('polarion', verify.get('jira', '')),
'verifies')
tc_linked = ElTree.SubElement(tc, 'linked-work-items')
for verify in [verify for verify in self.verifies
if isinstance(verify, dict)]:
PolarionXmlUtils.new_linked_work_item(
tc_linked,
verify.get('polarion', verify.get('jira', '')),
'verifies')

# testcase/test-steps
if self.steps:
tc_steps = etree.SubElement(tc, 'test-steps')
tc_steps = ElTree.SubElement(tc, 'test-steps')

# If test case has parameters, add them
if self.parameters:
Expand All @@ -235,6 +237,6 @@ def to_xml(self):
for step in self.steps:
PolarionXmlUtils.new_test_step(tc_steps, step.step, step.result)

xml_str = minidom.parseString(etree.tostring(xmlroot)).toprettyxml()
xml_str = minidom.parseString(ElTree.tostring(xmlroot)).toprettyxml()

return xml_str
Loading