Skip to content
Snippets Groups Projects

Resolve "Replace inspect.getargspec references"

Merged Moritz Huebner requested to merge 208-replace-inspect-getargspec-references into master

Closes #208 (closed)

Edited by Moritz Huebner

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • It looks like you've added a test script and then removed it from the CI. Do you intend to make it run before merging?

    EDIT: I see you just removed it from python 2. Can you explain the added functionality in python 3 that justifies this?

    Edited by Colm Talbot
  • Moritz Huebner resolved all discussions

    resolved all discussions

  • Moritz Huebner added 1 commit

    added 1 commit

    • 24996a86 - Refactored code for inspection utils functions into protected function

    Compare with previous version

  • @colm.talbot The reason for excluding this is because I am testing that we correctly functions that implement type hinting, e.g.

    def foo(a: int, b: float):
       print('bar')

    Type hinting simply does not exist in python 2 and the tests break. There is no good way I have found to work around this without excluding at least the entire test class.

  • I can see if there is a better solution for this.

  • It might not be the neatest solution, but can you define the functions inside the test methods? E.g.,

    class TestInferParameters(unittest.TestCase):
        
        def setUp(self):
            pass
    
        def tearDown(self):
            pass
    
        @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
        def test_type_hinting(self):
            def source1(freqs, a, b: int):
                return None
            expected = ['a', 'b']
            actual = utils.infer_parameters_from_function(source1)
            self.assertListEqual(expected, actual)
    
  • I can try that and I tried something similar before. I think it may still go wrong because the Python 2 interpreter may not be able to deal with the colon after b.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading