Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
f1c5a72c
Commit
f1c5a72c
authored
Dec 03, 2015
by
MinchinWeb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide `mock` and `shutil.get_terminal_size` for testing on PyPy 3.
parent
650a420c
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
45 deletions
+75
-45
README.md
README.md
+14
-0
setup.py
setup.py
+2
-0
test/test_list_command.py
test/test_list_command.py
+8
-1
test/test_list_format.py
test/test_list_format.py
+43
-41
topydo/lib/Utils.py
topydo/lib/Utils.py
+8
-3
No files found.
README.md
View file @
f1c5a72c
...
...
@@ -32,6 +32,16 @@ Simply install with:
(not supported for Python 3.2).
*
[
prompt-toolkit
][
6
]
: For topydo's _prompt_ mode, which offers a shell-like
interface with auto-completion.
*
[
arrow
][
8
]
: Used to turn dates into a human readable version.
*
[
backports.shutil_get_terminal_size
][
9
]
: Used to determine your terminal
window size. This function was
added to the standard library in
Python 3.3 and so is only
required in older versions of
Python.
*
[
python-dateutil
][
10
]
: A dependency of
*arrow*
.
*
[
mock
][
11
]
: Used for testing. This was added to the standard
library in Python 3.3.
Demo
----
...
...
@@ -46,3 +56,7 @@ Demo
[
5
]:
https://raw.githubusercontent.com/bram85/topydo/master/doc/topydo.gif
[
6
]:
https://github.com/jonathanslenders/python-prompt-toolkit
[
7
]:
https://github.com/collective/icalendar
[
8
]:
https://github.com/crsmithdev/arrow
[
9
]:
https://github.com/chrippa/backports.shutil_get_terminal_size
[
10
]:
https://dateutil.readthedocs.org/
[
11
]:
https://github.com/testing-cabal/mock
setup.py
View file @
f1c5a72c
...
...
@@ -33,9 +33,11 @@ setup(
],
extras_require
=
{
':sys_platform=="win32"'
:
[
'colorama>=0.2.5'
],
':python_version=="3.2"'
:
[
'backports.shutil_get_terminal_size>=1.0.0'
],
'ical'
:
[
'icalendar'
],
'prompt-toolkit'
:
[
'prompt-toolkit >= 0.53'
],
'test'
:
[
'coverage'
,
'freezegun'
,
'green'
,
],
'test:python_version=="3.2"'
:
[
'mock'
],
},
entry_points
=
{
'console_scripts'
:
[
'topydo = topydo.cli.UILoader:main'
],
...
...
test/test_list_command.py
View file @
f1c5a72c
...
...
@@ -18,13 +18,20 @@ import codecs
import
re
import
unittest
from
collections
import
namedtuple
from
unittest
import
mock
from
test.command_testcase
import
CommandTest
from
test.facilities
import
load_file_to_todolist
from
topydo.commands.ListCommand
import
ListCommand
from
topydo.lib.Config
import
config
# We're searching for 'mock'
# 'mock' was added as 'unittest.mock' in Python 3.3, but PyPy 3 is based on Python 3.2
# pylint: disable=no-name-in-module
try
:
from
unittest
import
mock
except
ImportError
:
import
mock
class
ListCommandTest
(
CommandTest
):
def
setUp
(
self
):
...
...
test/test_list_format.py
View file @
f1c5a72c
This diff is collapsed.
Click to expand it.
topydo/lib/Utils.py
View file @
f1c5a72c
...
...
@@ -23,6 +23,12 @@ import re
from
collections
import
namedtuple
from
datetime
import
date
# shutil.get_terminal_size was added to the standard library in Python 3.3
try
:
from
shutil
import
get_terminal_size
as
_get_terminal_size
# pylint: disable=no-name-in-module
except
ImportError
:
from
backports.shutil_get_terminal_size
import
get_terminal_size
as
_get_terminal_size
# pylint: disable=import-error
def
date_string_to_date
(
p_date
):
"""
...
...
@@ -54,15 +60,14 @@ def escape_ansi(p_string):
escape_ansi
.
pattern
=
re
.
compile
(
r'\x1b[^m]*m'
)
def
get_terminal_size
():
"""
Try to determine terminal size at run time. If that is not possible,
returns the default size of 80x24.
"""
from
shutil
import
get_terminal_size
# pylint: disable=no-name-in-module
try
:
sz
=
get_terminal_size
()
sz
=
_
get_terminal_size
()
except
ValueError
:
"""
This can result from the 'underlying buffer being detached', which
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment