Skip to content

Commit

Permalink
Merge pull request #8 from s4int/python3
Browse files Browse the repository at this point in the history
Python3
  • Loading branch information
s4int authored Jul 5, 2020
2 parents 8ab24e0 + 2d2f5e1 commit 1925e14
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 11 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: python
python:
- 2.7
- 3.6

install:
- pip install -r requirements.txt
- pip install .
script:
- robot -x xunit.xml tests
2 changes: 1 addition & 1 deletion CSVLibrary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csv
from robot.api import logger
from version import VERSION
from .version import VERSION

__version__ = VERSION

Expand Down
2 changes: 1 addition & 1 deletion CSVLibrary/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '0.0.2'
VERSION = '0.0.3'
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include requirements.txt README.md
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Build Status](https://travis-ci.org/s4int/robotframework-CSVLibrary.svg?branch=master)](https://travis-ci.org/s4int/robotframework-CSVLibrary)
[![Build Status](https://img.shields.io/pypi/v/robotframework-CSVLibrary.svg?label=version)](https://pypi.python.org/pypi/robotframework-CSVLibrary)

# Robot Framework CSVLibrary
## Introduction
CSVLibrary is a [Robot Framework](http://robotframework.org/) library for handling csv files.
Expand Down
2 changes: 1 addition & 1 deletion doc/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from robot.libdoc import libdoc
except:
def main():
print """Robot Framework 2.7 or later required for generating documentation"""
print("Robot Framework 2.7 or later required for generating documentation")
else:
def main():
libdoc(join(dirname(__file__), '..', 'CSVLibrary'), join(dirname(__file__), 'CSVLibrary.html'))
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
robotframework >= 2.6.0
27 changes: 19 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
#!/usr/bin/env python

import sys
from os.path import join, dirname
from setuptools import setup

execfile(join(dirname(__file__), 'CSVLibrary', 'version.py'))
CURDIR = dirname(__file__)
with open(join(CURDIR, 'requirements.txt')) as f:
REQUIREMENTS = f.read().splitlines()

DESCRIPTION = """
CSV file support for Robot Framework.
"""[1:-1]
filename = join(CURDIR, 'CSVLibrary', 'version.py')
if sys.version_info.major >= 3:
exec(compile(open(filename).read(), filename, 'exec'))
else:
execfile(filename)

with open(join(CURDIR, 'README.md')) as f:
DESCRIPTION = f.read()

setup(name = 'robotframework-csvlibrary',
version = VERSION,
description = 'CSV library for Robot Framework',
long_description = DESCRIPTION,
long_description_content_type='text/markdown',
author = 'Marcin Mierzejewski',
author_email = '<mmierz@gmail.com>',
url = 'https://github.com/s4int/robotframework-CSVLibrary',
Expand All @@ -24,10 +33,12 @@
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Software Development :: Testing"
],
install_requires = [
'robotframework >= 2.6.0',
"Topic :: Software Development :: Testing",
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
],
install_requires = REQUIREMENTS,
packages = ['CSVLibrary'],
)
23 changes: 23 additions & 0 deletions tests/ReadCSVTest.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*** Settings ***
Documentation CSV examples for Robot Framework.
Library Collections
Library CSVLibrary

*** Variables ***
# Example data generated with: https://www.mockaroo.com/
@{template_list}= 1 Douglas Morris dmorris0@mozilla.org Male 205.4.212.229
&{template_dict}= id=1 first_name=Douglas last_name=Morris email=dmorris0@mozilla.org gender=Male ip_address=205.4.212.229
&{template_dict_quoting}= id=1 first_name=Douglas last_name=Morris email=dmorris0@mozilla.org gender="Male ip_address=205.4.212.229

*** Test Cases ***
Read csv file to a list example test
@{list}= read csv file to list ${CURDIR}${/}data.csv
lists should be equal ${template_list} ${list[1]}

Read csv file to a dict example test
@{dict}= read csv file to associative ${CURDIR}${/}data.csv
dictionaries should be equal ${template_dict} ${dict[0]}

Read csv file without quoting to associative
@{dict}= read csv file to associative ${CURDIR}${/}data_quoting.csv delimiter=, quoting=${3}
dictionaries should be equal ${template_dict_quoting} ${dict[0]}
11 changes: 11 additions & 0 deletions tests/data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id,first_name,last_name,email,gender,ip_address
1,Douglas,Morris,dmorris0@mozilla.org,Male,205.4.212.229
2,Stephanie,Oliver,soliver1@google.com.br,Female,18.101.154.106
3,Russell,Castillo,rcastillo2@shop-pro.jp,Male,255.52.95.46
4,Helen,Reed,hreed3@rambler.ru,Female,167.55.67.109
5,Jesse,Wagner,jwagner4@histats.com,Male,252.37.62.215
6,Ashley,Diaz,adiaz5@wikia.com,Female,79.87.105.139
7,Rachel,Robinson,rrobinson6@blogger.com,Female,132.66.117.101
8,Phillip,Johnston,pjohnston7@disqus.com,Male,70.152.55.21
9,Craig,Burton,cburton8@toplist.cz,Male,73.117.157.82
10,Patrick,Fisher,pfisher9@1und1.de,Male,2.36.191.97
11 changes: 11 additions & 0 deletions tests/data_quoting.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id,first_name,last_name,email,gender,ip_address
1,Douglas,Morris,dmorris0@mozilla.org,"Male,205.4.212.229
2,Stephanie,Oliver,soliver1@google.com.br,Female,18.101.154.106
3,Russell,Castillo,rcastillo2@shop-pro.jp,Male,255.52.95.46
4,Helen,Reed,hreed3@rambler.ru,Female,167.55.67.109
5,Jesse,Wagner,jwagner4@histats.com,Male,252.37.62.215
6,Ashley,Diaz,adiaz5@wikia.com,Female,79.87.105.139
7,Rachel,Robinson,rrobinson6@blogger.com,Female,132.66.117.101
8,Phillip,Johnston,pjohnston7@disqus.com,Male,70.152.55.21
9,Craig,Burton,cburton8@toplist.cz,Male,73.117.157.82
10,Patrick,Fisher,pfisher9@1und1.de,Male,2.36.191.97

0 comments on commit 1925e14

Please sign in to comment.