[HELP NEEDED] Python3 unittest file mocking is not working

Hi there lovely people of Travis.

I have this weird issue where I have this unit test:

    @patch('fsyncer.fsyncer.Path.is_file')
    @patch("builtins.open", new_callable=mock_open, read_data="test_repo\n")
    @patch("fsyncer.fsyncer.sync_list")
    def test_main_with_config_file(self, mock_sync_list, _, mock_path):
        mock_path.return_value = True
        fsyncer.main()
        mock_sync_list.assert_called_with(['test_repo'])
        mock_path.assert_called()

Pretty straight forward stuff and it runs successfully every where I tried so far. That’s linux and osx. I saw that travis is running linux so I tried running this ins a container and succeeded.

Now, however when running this ons travis, it fails with the assert_called_with that it was not called with [‘test_repo’] ( the value that would come from a file ) but with an empty array.

Which is confusing as hell and I don’t understand why it’s not working.

Here is a run: https://travis-ci.org/Skarlso/fsyncer/builds/480287822
And here is the project and said code: https://github.com/Skarlso/fsyncer/blob/master/test/test_fsync.py#L33

Please someone help for the love of all that’s holy and my sanity.

Thanks!

Imprint