Skip to content

Commit 5680120

Browse files
committed
test latest pyexcel v0.2.2
1 parent b83e3bb commit 5680120

File tree

10 files changed

+89
-56
lines changed

10 files changed

+89
-56
lines changed

.moban.d/travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ matrix:
1616
env: DJANGO_VERSION=1.8.2
1717
{%endblock%}
1818

19-
{%block test_other_python_versions%} - 3.3
19+
{%block custom_python_versions%}
20+
python:
21+
- 2.6
22+
- 2.7
23+
- 3.3
2024
- 3.4
2125
- 3.5
2226
{%endblock%}

.travis.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ sudo: false
22
language: python
33
notifications:
44
email: false
5-
env:
65
- DJANGO_VERSION=1.7.8
76
- DJANGO_VERSION=1.8.2
87
- DJANGO_VERSION=1.9
98
python:
9+
- 2.6
1010
- 2.7
1111
- 3.3
1212
- 3.4
@@ -19,11 +19,16 @@ matrix:
1919
env: DJANGO_VERSION=1.7.8
2020
- python: 3.5
2121
env: DJANGO_VERSION=1.8.2
22-
install:
22+
before_install:
2323
- pip install Django==$DJANGO_VERSION
24-
- pip install -r requirements.txt
24+
- if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then
25+
mv min_requirements.txt requirements.txt ;
26+
fi
27+
- test ! -f rnd_requirements.txt || pip install --upgrade "setuptools" "pip==7.1"
28+
- test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt
29+
- test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ;
2530
- pip install -r tests/requirements.txt
2631
script:
2732
make test
2833
after_success:
29-
codecov
34+
codecov

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
include README.rst
2+
include CHANGELOG.rst

README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The highlighted features are:
4949
`pyexcel-text`_ (write only)json, rst, mediawiki,
5050
latex, grid, pipe, orgtbl, plain simple
5151
================ ========================================
52-
52+
5353
.. _pyexcel-xls: https://github.com/pyexcel/pyexcel-xls
5454
.. _pyexcel-xlsx: https://github.com/pyexcel/pyexcel-xlsx
5555
.. _pyexcel-ods: https://github.com/pyexcel/pyexcel-ods
@@ -65,10 +65,11 @@ and export from SQL databases, information analysis and persistence. It uses
6565
#. to provide one-stop utility to import the data in uploaded file into a database and to export tables in a database as excel files for file download.
6666
#. to provide the same interface for information persistence at server side: saving a uploaded excel file to and loading a saved excel file from file system.
6767

68+
6869
Known constraints
6970
==================
7071

71-
Fonts, colors and charts are not supported.
72+
Fonts, colors and charts are not supported.
7273

7374
Tested Django Versions
7475
========================

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,4 @@
250250
#texinfo_show_urls = 'footnote'
251251

252252
# If true, do not generate a @detailmenu in the "Top" node's menu.
253-
#texinfo_no_detailmenu = False
253+
#texinfo_no_detailmenu = False

doc/source/index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The highlighted features are:
5050
`pyexcel-text`_ (write only)json, rst, mediawiki,
5151
latex, grid, pipe, orgtbl, plain simple
5252
================ ========================================
53-
53+
5454
.. _pyexcel-xls: https://github.com/pyexcel/pyexcel-xls
5555
.. _pyexcel-xlsx: https://github.com/pyexcel/pyexcel-xlsx
5656
.. _pyexcel-ods: https://github.com/pyexcel/pyexcel-ods
@@ -66,6 +66,7 @@ and export from SQL databases, information analysis and persistence. It uses
6666
#. to provide one-stop utility to import the data in uploaded file into a database and to export tables in a database as excel files for file download.
6767
#. to provide the same interface for information persistence at server side: saving a uploaded excel file to and loading a saved excel file from file system.
6868

69+
6970
Installation
7071
-------------------
7172

@@ -102,7 +103,7 @@ You will need to update your *settings.py*::
102103

103104
More excel file formats
104105
------------------------
105-
106+
106107
The example application understands csv, tsv and its zipped variants: csvz and tsvz. If you would like to expand the list of supported excel file formats (see :ref:`file-format-list`) for your own application, you could include one or all of the following import lines right after **django-excel** is imported::
107108

108109
import pyexcel.ext.xls # pip install pyexcel-xls
@@ -535,3 +536,4 @@ Indices and tables
535536
* :ref:`genindex`
536537
* :ref:`modindex`
537538
* :ref:`search`
539+

sample-data.xls

0 Bytes
Binary file not shown.

setup.py

Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,40 @@
55
use_setuptools()
66
from setuptools import setup, find_packages
77

8-
with open("README.rst", 'r') as readme:
9-
README_txt = readme.read()
8+
NAME = 'django-excel'
9+
AUTHOR = 'C.W.'
10+
VERSION = '0.0.4'
11+
EMAIL = 'wangc_2011 (at) hotmail.com'
12+
LICENSE = 'New BSD'
13+
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests'])
14+
DESCRIPTION = 'A django middleware that provides one application programming interface to read and write data in different excel file formats'
15+
KEYWORDS = [
16+
'excel',
17+
'python',
18+
'pyexcel',
19+
'API',
20+
'Django'
21+
]
1022

11-
dependencies = [
23+
INSTALL_REQUIRES = [
1224
'pyexcel>=0.2.0',
1325
'pyexcel-webio>=0.0.6',
1426
'Django>=1.7.1',
1527
]
1628

17-
extras = {
29+
EXTRAS_REQUIRE = {
1830
'xls': ['pyexcel-xls>=0.1.0'],
1931
'xlsx': ['pyexcel-xlsx>=0.1.0'],
2032
'ods': ['pyexcel-ods3>=0.1.0'],
2133
}
2234

23-
24-
setup(
25-
name='django-excel',
26-
author='C.W.',
27-
version='0.0.4',
28-
author_email='wangc_2011 (at) hotmail.com',
29-
url='https://github.com/pyexcel/django-excel',
30-
description='A django middleware that provides one application programming interface to read and write data in different excel file formats',
31-
install_requires=dependencies,
32-
extras_require=extras,
33-
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
34-
include_package_data=True,
35-
long_description=README_txt,
36-
zip_safe=False,
37-
tests_require=['nose'],
38-
keywords=[
39-
'excel',
40-
'python',
41-
'pyexcel',
42-
'API',
43-
'Django'
44-
],
45-
license='New BSD',
46-
classifiers=[
47-
'Topic :: Office/Business',
48-
'Topic :: Utilities',
49-
'Topic :: Software Development :: Libraries',
50-
'Programming Language :: Python',
51-
'License :: OSI Approved :: BSD License',
52-
'Intended Audience :: Developers',
35+
CLASSIFIERS = [
36+
'Topic :: Office/Business',
37+
'Topic :: Utilities',
38+
'Topic :: Software Development :: Libraries',
39+
'Programming Language :: Python',
40+
'License :: OSI Approved :: BSD License',
41+
'Intended Audience :: Developers',
5342
'Development Status :: 3 - Alpha',
5443
'Environment :: Web Environment',
5544
'Topic :: Internet :: WWW/HTTP',
@@ -63,5 +52,38 @@
6352
'Programming Language :: Python :: 3.3',
6453
'Programming Language :: Python :: 3.4',
6554
'Programming Language :: Python :: 3.5'
66-
]
67-
)
55+
]
56+
57+
58+
def read_files(*files):
59+
"""Read files into setup"""
60+
text = ""
61+
for single_file in files:
62+
text = text + read(single_file) + "\n"
63+
return text
64+
65+
66+
def read(afile):
67+
"""Read a file into setup"""
68+
with open(afile, 'r') as opened_file:
69+
return opened_file.read()
70+
71+
72+
if __name__ == '__main__':
73+
setup(
74+
name=NAME,
75+
author=AUTHOR,
76+
version=VERSION,
77+
author_email=EMAIL,
78+
description=DESCRIPTION,
79+
install_requires=INSTALL_REQUIRES,
80+
keywords=KEYWORDS,
81+
extras_require=EXTRAS_REQUIRE,
82+
packages=PACKAGES,
83+
include_package_data=True,
84+
long_description=read_files('README.rst', 'CHANGELOG.rst'),
85+
zip_safe=False,
86+
tests_require=['nose'],
87+
license=LICENSE,
88+
classifiers=CLASSIFIERS
89+
)

testResponse.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ def testBook(self):
138138
assert response2.status_code == 200
139139
book = pe.get_book(file_type='xls', file_content=response2.content)
140140
content = dedent("""
141-
Sheet Name: question
141+
question:
142142
+----+---------------------------+----------------------------------------------+----------+
143143
| id | pub_date | question_text | slug |
144144
+----+---------------------------+----------------------------------------------+----------+
145145
| 1 | 2015-01-28T00:00:00+00:00 | What is your favourite programming language? | language |
146146
+----+---------------------------+----------------------------------------------+----------+
147147
| 2 | 2015-01-29T00:00:00+00:00 | What is your favourite IDE? | ide |
148148
+----+---------------------------+----------------------------------------------+----------+
149-
Sheet Name: choice
149+
choice:
150150
+---------------+----+-------------+-------+
151151
| choice_text | id | question_id | votes |
152152
+---------------+----+-------------+-------+
@@ -164,7 +164,7 @@ def testBook(self):
164164
+---------------+----+-------------+-------+
165165
| IntelliJ | 7 | 2 | 0 |
166166
+---------------+----+-------------+-------+""").strip('\n')
167-
assert str(book) == content
167+
self.assertEqual(str(book), content)
168168

169169
def testSheet(self):
170170
fp = open(self.testfile, "rb")
@@ -174,7 +174,7 @@ def testSheet(self):
174174
assert response2.status_code == 200
175175
sheet = pe.get_sheet(file_type='xls', file_content=response2.content)
176176
content = dedent("""
177-
Sheet Name: question
177+
question:
178178
+----+---------------------------+----------------------------------------------+----------+
179179
| id | pub_date | question_text | slug |
180180
+----+---------------------------+----------------------------------------------+----------+
@@ -192,15 +192,15 @@ def testImportSheet(self):
192192
assert response2.status_code == 200
193193
sheet = pe.get_sheet(file_type='xls', file_content=response2.content)
194194
content = dedent("""
195-
Sheet Name: question
195+
question:
196196
+----+---------------------------+----------------------------------------------+----------+
197197
| id | pub_date | question_text | slug |
198198
+----+---------------------------+----------------------------------------------+----------+
199199
| 1 | 2015-01-28T00:00:00+00:00 | What is your favourite programming language? | language |
200200
+----+---------------------------+----------------------------------------------+----------+
201201
| 2 | 2015-01-29T00:00:00+00:00 | What is your favourite IDE? | ide |
202202
+----+---------------------------+----------------------------------------------+----------+""").strip('\n')
203-
assert str(sheet) == content
203+
self.assertEqual(str(sheet), content)
204204

205205
def testCustomExport(self):
206206
fp = open(self.testfile, "rb")
@@ -210,7 +210,7 @@ def testCustomExport(self):
210210
assert response2.status_code == 200
211211
sheet = pe.get_sheet(file_type='xls', file_content=response2.content)
212212
content = dedent("""
213-
Sheet Name: pyexcel_sheet1
213+
pyexcel_sheet1:
214214
+---------------+----+-------+
215215
| choice_text | id | votes |
216216
+---------------+----+-------+
@@ -222,7 +222,7 @@ def testCustomExport(self):
222222
+---------------+----+-------+
223223
| IntelliJ | 7 | 0 |
224224
+---------------+----+-------+""").strip('\n')
225-
assert str(sheet) == content
225+
self.assertEqual(str(sheet), content)
226226

227227

228228
@override_settings(FILE_UPLOAD_MAX_MEMORY_SIZE=1)

tests/requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
nose
2-
rednose
3-
nose-cov
42
codecov
53
coverage
64
lxml

0 commit comments

Comments
 (0)