Skip to content

Commit 1925e14

Browse files
authored
Merge pull request #8 from s4int/python3
Python3
2 parents 8ab24e0 + 2d2f5e1 commit 1925e14

File tree

11 files changed

+82
-11
lines changed

11 files changed

+82
-11
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: python
2+
python:
3+
- 2.7
4+
- 3.6
5+
6+
install:
7+
- pip install -r requirements.txt
8+
- pip install .
9+
script:
10+
- robot -x xunit.xml tests

CSVLibrary/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import csv
22
from robot.api import logger
3-
from version import VERSION
3+
from .version import VERSION
44

55
__version__ = VERSION
66

CSVLibrary/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '0.0.2'
1+
VERSION = '0.0.3'

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include requirements.txt README.md

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[![Build Status](https://travis-ci.org/s4int/robotframework-CSVLibrary.svg?branch=master)](https://travis-ci.org/s4int/robotframework-CSVLibrary)
2+
[![Build Status](https://img.shields.io/pypi/v/robotframework-CSVLibrary.svg?label=version)](https://pypi.python.org/pypi/robotframework-CSVLibrary)
3+
14
# Robot Framework CSVLibrary
25
## Introduction
36
CSVLibrary is a [Robot Framework](http://robotframework.org/) library for handling csv files.

doc/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from robot.libdoc import libdoc
55
except:
66
def main():
7-
print """Robot Framework 2.7 or later required for generating documentation"""
7+
print("Robot Framework 2.7 or later required for generating documentation")
88
else:
99
def main():
1010
libdoc(join(dirname(__file__), '..', 'CSVLibrary'), join(dirname(__file__), 'CSVLibrary.html'))

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
robotframework >= 2.6.0

setup.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
#!/usr/bin/env python
22

3+
import sys
34
from os.path import join, dirname
45
from setuptools import setup
56

6-
execfile(join(dirname(__file__), 'CSVLibrary', 'version.py'))
7+
CURDIR = dirname(__file__)
8+
with open(join(CURDIR, 'requirements.txt')) as f:
9+
REQUIREMENTS = f.read().splitlines()
710

8-
DESCRIPTION = """
9-
CSV file support for Robot Framework.
10-
"""[1:-1]
11+
filename = join(CURDIR, 'CSVLibrary', 'version.py')
12+
if sys.version_info.major >= 3:
13+
exec(compile(open(filename).read(), filename, 'exec'))
14+
else:
15+
execfile(filename)
16+
17+
with open(join(CURDIR, 'README.md')) as f:
18+
DESCRIPTION = f.read()
1119

1220
setup(name = 'robotframework-csvlibrary',
1321
version = VERSION,
1422
description = 'CSV library for Robot Framework',
1523
long_description = DESCRIPTION,
24+
long_description_content_type='text/markdown',
1625
author = 'Marcin Mierzejewski',
1726
author_email = '<[email protected]>',
1827
url = 'https://github.com/s4int/robotframework-CSVLibrary',
@@ -24,10 +33,12 @@
2433
"License :: OSI Approved :: Apache Software License",
2534
"Operating System :: OS Independent",
2635
"Programming Language :: Python",
27-
"Topic :: Software Development :: Testing"
28-
],
29-
install_requires = [
30-
'robotframework >= 2.6.0',
36+
"Topic :: Software Development :: Testing",
37+
'Programming Language :: Python :: 2',
38+
'Programming Language :: Python :: 2.7',
39+
'Programming Language :: Python :: 3',
40+
'Programming Language :: Python :: 3.6',
3141
],
42+
install_requires = REQUIREMENTS,
3243
packages = ['CSVLibrary'],
3344
)

tests/ReadCSVTest.robot

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
*** Settings ***
2+
Documentation CSV examples for Robot Framework.
3+
Library Collections
4+
Library CSVLibrary
5+
6+
*** Variables ***
7+
# Example data generated with: https://www.mockaroo.com/
8+
@{template_list}= 1 Douglas Morris [email protected] Male 205.4.212.229
9+
&{template_dict}= id=1 first_name=Douglas last_name=Morris [email protected] gender=Male ip_address=205.4.212.229
10+
&{template_dict_quoting}= id=1 first_name=Douglas last_name=Morris [email protected] gender="Male ip_address=205.4.212.229
11+
12+
*** Test Cases ***
13+
Read csv file to a list example test
14+
@{list}= read csv file to list ${CURDIR}${/}data.csv
15+
lists should be equal ${template_list} ${list[1]}
16+
17+
Read csv file to a dict example test
18+
@{dict}= read csv file to associative ${CURDIR}${/}data.csv
19+
dictionaries should be equal ${template_dict} ${dict[0]}
20+
21+
Read csv file without quoting to associative
22+
@{dict}= read csv file to associative ${CURDIR}${/}data_quoting.csv delimiter=, quoting=${3}
23+
dictionaries should be equal ${template_dict_quoting} ${dict[0]}

tests/data.csv

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
id,first_name,last_name,email,gender,ip_address
2+
1,Douglas,Morris,[email protected],Male,205.4.212.229
3+
2,Stephanie,Oliver,[email protected],Female,18.101.154.106
4+
3,Russell,Castillo,[email protected],Male,255.52.95.46
5+
4,Helen,Reed,[email protected],Female,167.55.67.109
6+
5,Jesse,Wagner,[email protected],Male,252.37.62.215
7+
6,Ashley,Diaz,[email protected],Female,79.87.105.139
8+
7,Rachel,Robinson,[email protected],Female,132.66.117.101
9+
8,Phillip,Johnston,[email protected],Male,70.152.55.21
10+
9,Craig,Burton,[email protected],Male,73.117.157.82
11+
10,Patrick,Fisher,[email protected],Male,2.36.191.97

0 commit comments

Comments
 (0)