This repository has been archived by the owner on Nov 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
All-in-one pull request #17
Open
kmike
wants to merge
19
commits into
noamraph:master
Choose a base branch
from
kmike:all-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
777314c
Ignore PyCharm IDE config files
obiwanus da4b29f
First dumb test
obiwanus a16cdc6
New lines at the end of files
obiwanus 2f46d54
Test of format_meter (failed on py32)
obiwanus 8bb8a17
Another format meter test
obiwanus e2e15d1
Fixed the calculation of rate in format_meter
obiwanus 5f0c72d
Readme: how to run tests
obiwanus 7b62451
Fixed the link to tox
obiwanus ff2b39a
Change 'iterator' to 'iterable' in README
fordhurley 4539ebc
Test that tqdm fails when iterating over a csv file
f565179
Another python 3 fix
152dfd5
Some more tests
obiwanus cbc6322
do my wheel !
5ed7338
Merge branch 'stonebig-master' into all-fixes
kmike 2e6cee7
Merge branch 'fordhurley-master' into all-fixes
kmike 3d9fd15
add more interpreters to tox.ini
kmike 888775a
add Travis CI
kmike 4c97924
add license and Python version info to setup.py
kmike ecc79f9
add Travis badge to README
kmike File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,6 @@ nosetests.xml | |
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# PyCharm | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: python | ||
python: 2.7 | ||
env: | ||
- TOXENV=py26 | ||
- TOXENV=py27 | ||
- TOXENV=py32 | ||
- TOXENV=py33 | ||
- TOXENV=py34 | ||
- TOXENV=pypy | ||
- TOXENV=pypy3 | ||
install: | ||
- pip install tox | ||
script: | ||
- tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
python_files = test*.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[bdist_wheel] | ||
universal = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from setuptools import setup | ||
|
||
from distutils.core import setup | ||
|
||
setup(name='tqdm', | ||
version='1.0', | ||
description='A Simple Python Progress Meter', | ||
author='Noam Yorav-Raphael', | ||
author_email='[email protected]', | ||
url='https://github.com/noamraph/tqdm', | ||
py_modules=['tqdm'], | ||
) | ||
setup( | ||
name='tqdm', | ||
version='1.0', | ||
description='A Simple Python Progress Meter', | ||
license='MIT License', | ||
author='Noam Yorav-Raphael', | ||
author_email='[email protected]', | ||
url='https://github.com/noamraph/tqdm', | ||
py_modules=['tqdm'], | ||
classifiers=[ | ||
'Development Status :: 5 - Production/Stable', | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.6', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.2', | ||
'Programming Language :: Python :: 3.3', | ||
'Programming Language :: Python :: 3.4', | ||
'Topic :: Software Development :: Libraries', | ||
'Intended Audience :: Developers', | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from __future__ import unicode_literals | ||
|
||
import csv | ||
from six import StringIO | ||
from tqdm import format_interval, format_meter, tqdm | ||
|
||
|
||
def test_format_interval(): | ||
assert format_interval(60) == '01:00' | ||
assert format_interval(6160) == '1:42:40' | ||
assert format_interval(238113) == '66:08:33' | ||
|
||
|
||
def test_format_meter(): | ||
assert format_meter(0, 1000, 13) == \ | ||
"|----------| 0/1000 0% [elapsed: " \ | ||
"00:13 left: ?, 0.00 iters/sec]" | ||
assert format_meter(231, 1000, 392) == \ | ||
"|##--------| 231/1000 23% [elapsed: " \ | ||
"06:32 left: 21:44, 0.59 iters/sec]" | ||
|
||
|
||
def test_nothing_fails(): | ||
""" Just make sure we're able to iterate using tqdm """ | ||
for i in tqdm(range(10)): | ||
pass | ||
|
||
|
||
def test_iterate_over_csv_rows(): | ||
# Create a test csv pseudo file | ||
test_csv_file = StringIO() | ||
writer = csv.writer(test_csv_file) | ||
for i in range(3): | ||
writer.writerow(['test', 'test', 'test']) | ||
test_csv_file.seek(0) | ||
|
||
# Test that nothing fails if we iterate over rows | ||
reader = csv.DictReader(test_csv_file, fieldnames=('row1', 'row2', 'row3')) | ||
for row in tqdm(reader): | ||
pass | ||
|
||
|
||
def test_file_output(): | ||
""" Tests that output to arbitrary file-like objects works """ | ||
our_file = StringIO() | ||
for i in tqdm(range(3), file=our_file): | ||
if i == 1: | ||
our_file.seek(0) | ||
assert '0/3' in our_file.read() | ||
|
||
|
||
def test_leave_option(): | ||
""" | ||
Tests that if leave=True, tqdm will leave the info | ||
about the last iteration on the screen | ||
""" | ||
our_file = StringIO() | ||
for i in tqdm(range(3), file=our_file, leave=True): | ||
pass | ||
our_file.seek(0) | ||
assert '3/3 100%' in our_file.read() | ||
our_file.close() | ||
|
||
our_file2 = StringIO() | ||
for i in tqdm(range(3), file=our_file2, leave=False): | ||
pass | ||
our_file2.seek(0) | ||
assert '3/3 100%' not in our_file2.read() | ||
our_file2.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Tox (http://tox.testrun.org/) is a tool for running tests | ||
# in multiple virtualenvs. This configuration file will run the | ||
# test suite on all supported python versions. To use it, "pip install tox" | ||
# and then run "tox" from this directory. | ||
|
||
[tox] | ||
envlist = py26, py27, py32, py33, py34, pypy, pypy3 | ||
|
||
[testenv] | ||
commands = py.test | ||
deps = | ||
six | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After merging this line should be changed.