Repository: colinfike/easy-ptvsd

Issue:
Strange functionality when used with @classmethod decorator
I'm seeing return values not being returned when using `wait_and_break` with `@classmethod` decorator.

Actually this is issue is definitely that I don't return the value the decorated function returns.

Comments:

Patch:
diff --git a/.gitignore b/.gitignore
index cb1663a..473dc19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
 __pycache__
 *.egg-info
 dist
+*.pyc
diff --git a/easy_ptvsd.py b/easy_ptvsd.py
index 6af5619..538747f 100644
--- a/easy_ptvsd.py
+++ b/easy_ptvsd.py
@@ -30,9 +30,11 @@ class wait_and_break:
 
     def __call__(self, function):
         """Run ptvsd code and continue with decorated function."""
+
         def wait_and_break_deco(*args, **kwargs):
             ptvsd.enable_attach(self.secret, address=self.address)
             ptvsd.wait_for_attach()
             ptvsd.break_into_debugger()
-            function(*args, **kwargs)
+            return function(*args, **kwargs)
+
         return wait_and_break_deco
diff --git a/setup.py b/setup.py
index 91fccaf..dac13b1 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
 
 setup(
     name="easy_ptvsd",
-    version="0.1.0",
+    version="0.1.1",
     description="A convenience package for PTVSD.",
     long_description=(
         "EasyPtvsd is a convenience library that makes it a bit easy to remote"
@@ -16,16 +16,14 @@ setup(
     author_email="colin.fike@gmail.com",
     license="MIT",
     classifiers=[
-        'Development Status :: 3 - Alpha',
-        'Intended Audience :: Developers',
-        'Topic :: Software Development',
-        'Programming Language :: Python :: 3',
+        "Development Status :: 3 - Alpha",
+        "Intended Audience :: Developers",
+        "Topic :: Software Development",
+        "Programming Language :: Python :: 3",
     ],
     keywords="ptvsd easy python remote debugging",
-    install_requires=[
-        'ptvsd==3.0.0',
-    ],
-    python_requires='>=3',
+    install_requires=["ptvsd==3.0.0"],
+    python_requires=">=3",
     py_modules=["easy_ptvsd"],
     packages=[],
 )


Test patch:
diff --git a/tests/test_easy_ptvsd.py b/tests/test_easy_ptvsd.py
index 945c629..63587e5 100644
--- a/tests/test_easy_ptvsd.py
+++ b/tests/test_easy_ptvsd.py
@@ -32,15 +32,16 @@ class TestWaitAndBreakClass(unittest.TestCase):
     @patch("easy_ptvsd.ptvsd")
     def test_decorated_function_wrapper_functionality(self, mock_ptvsd):
         """Test that the function returned by invoking wait_and_break is functional."""
-        decorated_func_mock = Mock()
+        decorated_func_mock = Mock(return_value="ret val")
         wait_and_break_obj = wait_and_break()
         result = wait_and_break_obj(decorated_func_mock)
 
-        result("positional_arg", key_word_arg="keywordarg")
+        return_value = result("positional_arg", key_word_arg="keywordarg")
 
         self.assertTrue(mock_ptvsd.enable_attach.called)
         self.assertTrue(mock_ptvsd.wait_for_attach.called)
         self.assertTrue(mock_ptvsd.break_into_debugger.called)
+        self.assertEqual(return_value, "ret val")
         decorated_func_mock.assert_called_once_with(
             "positional_arg", key_word_arg="keywordarg"
         )