Repository: joowani/dtags (language: python)

Issue:
Make it work with Fish 3.0
Need to replace all usage of `math` with `test`, which should work on all fish versions.


Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
index 4a58c9d..d10f0a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,6 @@ target/
 
 # PyCharm
 .idea
+
+# Pytest Cache
+.pytest_cache/
\ No newline at end of file
diff --git a/README.rst b/README.rst
index 48f096d..f0e8e33 100644
--- a/README.rst
+++ b/README.rst
@@ -5,15 +5,15 @@ Directory Tags for Lazy Programmers
     :target: https://badge.fury.io/py/dtags
     :alt: Package Version
 
-.. image:: https://img.shields.io/badge/python-2.7%2C%203.4-blue.svg
+.. image:: https://img.shields.io/badge/python-2.7%2C%203.4%2C%203.5%2C%203.6%2C%203.7-blue.svg
     :target: https://github.com/joowani/dtags
     :alt: Python Versions
 
-.. image:: https://img.shields.io/github/issues/joowani/dtags.svg   
+.. image:: https://img.shields.io/github/issues/joowani/dtags.svg
     :target: https://github.com/joowani/dtags/issues
     :alt: Issues Open
 
-.. image:: https://img.shields.io/badge/license-MIT-blue.svg   
+.. image:: https://img.shields.io/badge/license-MIT-blue.svg
     :target: https://raw.githubusercontent.com/joowani/dtags/master/LICENSE
     :alt: MIT License
 
@@ -32,7 +32,7 @@ Installation
 
 Check requirements:
 
--  Python 2.7.x, 3.4.x, 3.5.x or 3.6.x
+-  Python 2.7, 3.4, 3.5, 3.6 or 3.7
 -  Supported operating systems: Linux, OS X, Ubuntu on Windows
 -  Recent version of `pip <https://pip.pypa.io>`__
 -  Recent version of Bash, Zsh or Fish with tab-completion enabled
diff --git a/dtags/shells/fish.py b/dtags/shells/fish.py
index eac24fe..0857c10 100644
--- a/dtags/shells/fish.py
+++ b/dtags/shells/fish.py
@@ -37,7 +37,7 @@
         set _dtags_choice "{choice}"
         set -g _dtags_prompt "{prompt}"
     end
-    if math "1 >" (count $argv) > /dev/null
+    if [ 1 -gt (count $argv) ] > /dev/null
         cd $HOME
         return 0
     else if [ $argv[1] = "--help" ]
@@ -52,20 +52,20 @@
     else if echo "$argv[1]" | grep -q -E '^-' > /dev/null
         printf "$_dtags_arg_err" "$_dtags_usage" "$argv[1]"
         return 2
-    else if math "1 <" (count $argv) > /dev/null
+    else if [ 1 -lt (count $argv) ] > /dev/null
         printf "%sd: too many arguments\n" "$_dtags_usage"
         return 2
     end
     set _dtags_dirs (grep -F ,$argv[1], {mapping_file} | cut -d',' -f1)
     set -g _dtags_count (count $_dtags_dirs)
-    if math "$_dtags_count == 0" > /dev/null
+    if [ $_dtags_count -eq 0 ] > /dev/null
         if test -d $argv[1]
             set _dtags_dir $argv[1]
         else
             printf "$_dtags_dest_err" "$argv[1]"
             return 2
         end
-    else if math "$_dtags_count == 1" > /dev/null
+    else if [ $_dtags_count -eq 1 ] > /dev/null
         set _dtags_dir $_dtags_dirs[1]
     else
         for i in (seq $_dtags_count)
@@ -79,7 +79,7 @@
         if not echo "$_dtags_idx" | grep -q -E '^[0-9]+$' > /dev/null
             printf "$_dtags_input_err" "$_dtags_idx"
             return 2
-        else if math "$_dtags_idx > $_dtags_count" > /dev/null
+        else if [ $_dtags_idx -gt $_dtags_count ] > /dev/null
             printf "$_dtags_idx_err" "$_dtags_idx"
             return 2
         end
diff --git a/dtags/version.py b/dtags/version.py
index fc25b20..261a1a1 100644
--- a/dtags/version.py
+++ b/dtags/version.py
@@ -1,1 +1,1 @@
-VERSION = '3.2.3'
+VERSION = '3.2.4'
diff --git a/setup.py b/setup.py
index adf5493..807c223 100755
--- a/setup.py
+++ b/setup.py
@@ -51,9 +51,7 @@ def run(self):
         'Operating System :: MacOS :: MacOS X',
         'Operating System :: POSIX :: Linux',
         'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.4',
         'Natural Language :: English',
         'Topic :: Utilities',
     ],


Test patch:
diff --git a/tests.py b/tests.py
index 4cca16c..b6233d2 100644
--- a/tests.py
+++ b/tests.py
@@ -16,8 +16,6 @@
 import shutil
 import subprocess
 
-import pytest
-
 from dtags import CFG_DIR, MAPPING_FILE
 from dtags.chars import TAG_CHARS
 from dtags.version import VERSION
@@ -108,7 +106,6 @@ def run(command, shell=None):
     return '\n'.join(valid_output_lines)
 
 
-@pytest.mark.first
 def test_init():
     """Test if the commands work as expected when no tags are defined"""
     expected = 'Nothing to list\n'
@@ -121,7 +118,6 @@ def test_init():
     assert run('dtags clean') == 'Nothing to clean\n'
 
 
-@pytest.mark.second
 def test_t():
     """Test if 'tag' works as expected."""
     # Test basic argument handling
@@ -171,7 +167,6 @@ def test_t():
     assert run('t {} {} bar baz foo'.format(dir2, tag2)) == 'Nothing to do\n'
 
 
-@pytest.mark.third
 def test_dtags():
     """Test if 'dtags' works as expected."""
     # Test basic argument handling
@@ -251,7 +246,6 @@ def test_dtags():
         assert run('dtags-refresh fish | source', shell='fish') == ''
 
 
-@pytest.mark.fourth
 def test_d():
     """Test if the 'd' command works as expected."""
     # Test basic argument handling
@@ -271,7 +265,6 @@ def test_d():
     assert run('d {}'.format(bad_dir)) == expected_error
 
 
-@pytest.mark.fifth
 def test_e():
     """Test if the 'e' command works as expected."""
     # Test argument handling
@@ -302,7 +295,6 @@ def test_e():
         assert m.format(loc='{} #foo'.format(dir2), out=dir2) in output
 
 
-@pytest.mark.sixth
 def test_p():
     """Test if the 'e' command works as expected."""
     # Test argument handling
@@ -333,7 +325,6 @@ def test_p():
         assert m.format(loc='{} #foo'.format(dir2), out=dir2) in output
 
 
-@pytest.mark.seventh
 def test_u():
     """Test if 'untag' works as expected."""
     # Test basic argument handling
@@ -367,7 +358,6 @@ def test_u():
     assert run('dtags list {} foo bar baz'.format(tag1)) == 'Nothing to list\n'
 
 
-@pytest.mark.last
 def test_bad_mapping():
     """Test if bad mapping is handled properly."""
     assert run('dtags clean') == 'Nothing to clean\n'