Fix "TypeError: 'module' object is not callable" in test_commands.py #676

Merged
witten merged 1 commits from :import-flexmock-function into master 2023-04-14 02:12:59 +00:00
Contributor
No description provided.
polyzen added 1 commit 2023-04-14 01:02:00 +00:00
Owner

Thanks for catching this. Your fix is clearly more correct than the existing code. But what baffles me is that I wasn't getting any test errors before this change. Were you? Do you have any idea what was going on?

Thanks for catching this. Your fix is clearly more correct than the existing code. But what baffles me is that I wasn't getting any test errors before this change. Were you? Do you have any idea what was going on?
witten merged commit 8802f6888e into master 2023-04-14 02:12:59 +00:00
Author
Contributor

Thanks for catching this. Your fix is clearly more correct than the existing code. But what baffles me is that I wasn't getting any test errors before this change. Were you?

Haven't tried with tox. I use the following to run the tests:
82f2867fd6/trunk/PKGBUILD (L38-L44)
(-c /dev/null is to avoid having to pull in the python-coverage package.)

=================================== FAILURES ===================================
_______ test_transfer_archives_command_does_not_duplicate_flags_or_raise _______

    def test_transfer_archives_command_does_not_duplicate_flags_or_raise():
        arguments = borgmatic.commands.arguments.parse_arguments(
            'transfer', '--source-repository', 'foo'
        )['transfer']
>       flexmock(borgmatic.borg.transfer).should_receive('execute_command').replace_with(
            assert_command_does_not_duplicate_flags
        )
E       TypeError: 'module' object is not callable

tests/integration/borg/test_commands.py:52: TypeError
_____ test_display_archives_info_command_does_not_duplicate_flags_or_raise _____

    def test_display_archives_info_command_does_not_duplicate_flags_or_raise():
        arguments = borgmatic.commands.arguments.parse_arguments('info')['info']
>       flexmock(borgmatic.borg.info).should_receive('execute_command_and_capture_output').replace_with(
            assert_command_does_not_duplicate_flags
        )
E       TypeError: 'module' object is not callable

Do you have any idea what was going on?

I do not.

> Thanks for catching this. Your fix is clearly more correct than the existing code. But what baffles me is that I wasn't getting any test errors before this change. Were you? Haven't tried with tox. I use the following to run the tests: https://github.com/archlinux/svntogit-community/blob/82f2867fd6125362c73be177c194e7a3e4b1873e/trunk/PKGBUILD#L38-L44 (`-c /dev/null` is to avoid having to pull in the `python-coverage` package.) ```python =================================== FAILURES =================================== _______ test_transfer_archives_command_does_not_duplicate_flags_or_raise _______ def test_transfer_archives_command_does_not_duplicate_flags_or_raise(): arguments = borgmatic.commands.arguments.parse_arguments( 'transfer', '--source-repository', 'foo' )['transfer'] > flexmock(borgmatic.borg.transfer).should_receive('execute_command').replace_with( assert_command_does_not_duplicate_flags ) E TypeError: 'module' object is not callable tests/integration/borg/test_commands.py:52: TypeError _____ test_display_archives_info_command_does_not_duplicate_flags_or_raise _____ def test_display_archives_info_command_does_not_duplicate_flags_or_raise(): arguments = borgmatic.commands.arguments.parse_arguments('info')['info'] > flexmock(borgmatic.borg.info).should_receive('execute_command_and_capture_output').replace_with( assert_command_does_not_duplicate_flags ) E TypeError: 'module' object is not callable ``` > Do you have any idea what was going on? I do not.
polyzen deleted branch import-flexmock-function 2023-04-14 03:44:25 +00:00
Owner

Got it, thanks. I did confirm that the tests in question were running even before your change. And I noticed this from the flexmock docs:

Since version 0.10.0, it’s also possible to call flexmock module directly, so you can just do:
import flexmock

So maybe you just had an older version. Although following the python-flexmock link from the borgmatic Arch page shows a newer version. So, 🤷‍♂️.

Got it, thanks. I did confirm that the tests in question were running even before your change. And I noticed this from the `flexmock` docs: > Since version 0.10.0, it’s also possible to call flexmock module directly, so you can just do: > ```import flexmock``` So maybe you just had an older version. Although following the `python-flexmock` link from the [borgmatic Arch page](https://archlinux.org/packages/community/any/borgmatic/) shows a *newer* version. So, 🤷‍♂️.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#676
No description provided.