Repository: pimutils/todoman
Pull request #275 (2017-09-03 22:33:47)

Improve documentation on how to test locally
Add some docs on how to run tests locally, as well as how to run a working copy without installing it.


Patch:
diff --git a/.travis.yml b/.travis.yml
index beb1691..7ebd394 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -36,6 +36,12 @@ matrix:
       python: 3.6
       after_install:
         - echo click_repl >> requirements.txt
+      env: TOXENV=py EXTRAS=click_repl
+    - # Run tests with incompatible test dependencies:
+      python: 3.6
+      after_install:
+        - echo pyicu >> requirements.txt
+      env: TOXENV=py EXTRAS=pyicu
 
 addons:
   apt:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index e5a7fcc..9901f63 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -8,6 +8,7 @@ v3.2.2
 ------
 
 * Initial support for (bash) autocompletion.
+* The location field is not printed as part of ``--porcelain``.
 
 v3.2.1
 ------
diff --git a/LICENCE b/LICENCE
index ff09949..b7cd00f 100644
--- a/LICENCE
+++ b/LICENCE
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2016, Hugo Osvaldo Barrera <hugo@barrera.io>
+Copyright (c) 2015-2017, Hugo Osvaldo Barrera <hugo@barrera.io>
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
diff --git a/README.rst b/README.rst
index fb0099d..a4b84f4 100644
--- a/README.rst
+++ b/README.rst
@@ -60,4 +60,4 @@ consult the latest version of the manual at readthedocs_.
 LICENCE
 -------
 
-Todoman is licensed under the MIT licence. See LICENCE for details.
+Todoman is licensed under the ISC licence. See LICENCE for details.
diff --git a/contrib/completion/bash/_todo b/contrib/completion/bash/_todo
index c6e5f5e..df3ca7c 100644
--- a/contrib/completion/bash/_todo
+++ b/contrib/completion/bash/_todo
@@ -12,7 +12,7 @@ _todo_get_lists()
 
 _todo_get_locations()
 {
-	local pattern='^\s*"location": \([0-9]\)\+,'
+	local pattern='^\s*"location": \(.*\)\+,'
 	todo --porcelain list | grep -o "${pattern}" | sed -e "s/${pattern}/\1/" | sort | uniq
 }
 
diff --git a/docs/source/conf.py b/docs/source/conf.py
index e81ac88..ff4f94e 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -125,7 +125,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = 'Todoman'
-copyright = '2015-2016, Hugo Osvaldo Barrera'
+copyright = '2015-2017, Hugo Osvaldo Barrera'
 author = 'Hugo Osvaldo Barrera'
 
 # The version info for the project you're documenting, acts as replacement for
diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst
index 4f649fa..469a0a8 100644
--- a/docs/source/contributing.rst
+++ b/docs/source/contributing.rst
@@ -58,6 +58,23 @@ The main goal of this is to simplify how many conversions we have. If we read
 from disk to the editor, we'd need an extra VTodo->Todo conversion code that
 skips the cache.
 
+Running and testing locally
+---------------------------
+
+The easiest way to run tests, it to install ``tox``, and then simply run
+``tox``. By default, several python versions and environments are tested. If
+you want to run a specific one use ``tox -e ENV``, where ``ENV`` should be one
+of the environments listed by ``tox -l``.
+
+See the `tox`_ documentation for further details.
+
+To run your modified copy of ``todoman`` without installing it, it's
+recommended you set up a virtualenv, and run ``pip install -e .`` to install
+your checked-out copy into it (this'll make ``todo`` run your local copy while
+the virtualenv is active).
+
+.. _tox: http://tox.readthedocs.io/en/latest/
+
 Patch review checklist
 ~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/docs/source/licence.rst b/docs/source/licence.rst
index 6a19de4..b98599d 100644
--- a/docs/source/licence.rst
+++ b/docs/source/licence.rst
@@ -1,9 +1,9 @@
 Licence
 =======
 
-Todoman is licensed under the MIT licence::
+Todoman is licensed under the ISC licence::
 
-    Copyright (c) 2015-2016, Hugo Osvaldo Barrera <hugo@barrera.io>
+    Copyright (c) 2015-2017, Hugo Osvaldo Barrera <hugo@barrera.io>
 
     Permission to use, copy, modify, and/or distribute this software for any
     purpose with or without fee is hereby granted, provided that the above
diff --git a/setup.py b/setup.py
index 642241d..60ea58e 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ setup(
     author='Hugo Osvaldo Barrera',
     author_email='hugo@barrera.io',
     url='https://github.com/pimutils/todoman',
-    license='MIT',
+    license='ISC',
     packages=['todoman'],
     include_package_data=True,
     entry_points={
@@ -31,7 +31,7 @@ setup(
         'Development Status :: 4 - Beta',
         'Environment :: Console',
         'Environment :: Console :: Curses',
-        'License :: OSI Approved :: MIT License',
+        'License :: OSI Approved :: ISC License (ISCL)',
         'Operating System :: POSIX',
         'Programming Language :: Python :: 3',
         'Programming Language :: Python :: 3.3',
diff --git a/todoman/formatters.py b/todoman/formatters.py
index 980baa9..2cef306 100644
--- a/todoman/formatters.py
+++ b/todoman/formatters.py
@@ -213,6 +213,7 @@ class PorcelainFormatter(DefaultFormatter):
             percent=todo.percent_complete,
             summary=todo.summary,
             priority=todo.priority,
+            location=todo.location,
         )
 
     def compact(self, todo):
diff --git a/todoman/widgets.py b/todoman/widgets.py
index 4ccc733..192adb3 100644
--- a/todoman/widgets.py
+++ b/todoman/widgets.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2016 Hugo Osvaldo Barrera
+# Copyright (c) 2016-2017 Hugo Osvaldo Barrera
 # Copyright (c) 2013-2016 Christian Geier et al.
 #
 # Permission is hereby granted, free of charge, to any person obtaining


Test patch:
diff --git a/tests/helpers.py b/tests/helpers.py
new file mode 100644
index 0000000..dc39748
--- /dev/null
+++ b/tests/helpers.py
@@ -0,0 +1,20 @@
+__all__ = [
+    'pyicu_sensitive',
+]
+
+import pytest
+
+
+def is_pyicu_installed():
+    try:
+        import icu  # noqa: F401: This is an import to tests if it's installed.
+    except ImportError:
+        return False
+    else:
+        return True
+
+
+pyicu_sensitive = pytest.mark.skipif(
+    is_pyicu_installed(),
+    reason="This test cannot be run with pyicu installed.",
+)
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 0634dc4..e491294 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -11,6 +11,7 @@ from dateutil.tz import tzlocal
 from freezegun import freeze_time
 from hypothesis import given
 
+from tests.helpers import pyicu_sensitive
 from todoman.cli import cli, exceptions
 from todoman.model import Database, Todo
 
@@ -209,6 +210,7 @@ def test_move(tmpdir, runner, create):
     assert 'other_list' in result.output
 
 
+@pyicu_sensitive
 @freeze_time('2017-03-17 20:22:19')
 def test_dtstamp(tmpdir, runner, create):
     """Test that we add the DTSTAMP to new entries as per RFC5545."""
@@ -263,6 +265,7 @@ def test_default_due(
         )
 
 
+@pyicu_sensitive
 @freeze_time(datetime.datetime.now())
 def test_default_due2(tmpdir, runner, create, todos):
     cfg = tmpdir.join('config')
@@ -644,6 +647,7 @@ def test_todo_edit(runner, default_database, todo_factory):
     assert 'YARR!' in result.output
 
 
+@pyicu_sensitive
 @freeze_time('2017, 3, 20')
 def test_list_startable(tmpdir, runner, todo_factory):
     todo_factory(summary='started', start=datetime.datetime(2017, 3, 15))
diff --git a/tests/test_formatter.py b/tests/test_formatter.py
index 7316f56..2f50e57 100644
--- a/tests/test_formatter.py
+++ b/tests/test_formatter.py
@@ -4,10 +4,12 @@ import pytest
 import pytz
 from freezegun import freeze_time
 
+from tests.helpers import pyicu_sensitive
 from todoman.cli import cli
 from todoman.formatters import rgb_to_ansi
 
 
+@pyicu_sensitive
 @pytest.mark.parametrize('interval', [
     (65, 'in a minute'),
     (-10800, '3 hours ago'),
diff --git a/tests/test_porcelain.py b/tests/test_porcelain.py
index 8a3e210..0bbf1ec 100644
--- a/tests/test_porcelain.py
+++ b/tests/test_porcelain.py
@@ -14,6 +14,7 @@ def test_list_all(tmpdir, runner, create):
         'STATUS:COMPLETED\n'
         'DUE;VALUE=DATE-TIME;TZID=CET:20160102T000000\n'
         'PERCENT-COMPLETE:26\n'
+        'LOCATION:Wherever\n'
     )
     result = runner.invoke(cli, ['--porcelain', 'list', '--status', 'ANY'])
 
@@ -22,6 +23,7 @@ def test_list_all(tmpdir, runner, create):
         'due': 1451689200,
         'id': 1,
         'list': 'default',
+        'location': 'Wherever',
         'percent': 26,
         'priority': 0,
         'summary': 'Do stuff',
@@ -46,6 +48,7 @@ def test_list_nodue(tmpdir, runner, create):
         'due': None,
         'id': 1,
         'list': 'default',
+        'location': '',
         'percent': 12,
         'priority': 4,
         'summary': 'Do stuff',
@@ -132,6 +135,7 @@ def test_show(tmpdir, runner, create):
         'due': None,
         'id': 1,
         'list': 'default',
+        'location': '',
         'percent': 0,
         'priority': 5,
         'summary': 'harhar',
@@ -151,6 +155,7 @@ def test_simple_action(todo_factory):
         "due": None,
         "id": 7,
         "list": "default",
+        "location": "Downtown",
         "percent": 0,
         "priority": 0,
         "summary": "YARR!"