在 Python 3.6 中,我unittest.mock.patch用来修补这样的函数:
class SampleTest(TestCase):
@mock.patch('some_module.f')
def test_f(self, mocked_f):
f()
mocked_f.assert_called()
Run Code Online (Sandbox Code Playgroud)
This passes a mock.MagicMock() as mocked_f and everything works fine. However, when I want to use a custom mock object instead of the default mock.MagicMock() using new argument, the patch decorator does not pass the mocked object to the test_f method. Running this code will raise a TypeError:
class SampleTest(TestCase):
@mock.patch('some_module.f', new=lambda: 8)
def test_f(self, mocked_f):
f()
mocked_f.assert_called()
Run Code Online (Sandbox Code Playgroud)
TypeError: test_f() missing 1 required positional argument: …Run Code Online (Sandbox Code Playgroud) 我的服务器上运行了一个Gitlab CE 11.7 docker。当我从gitlab.com导入项目时,缺少其Wiki。我使用内置界面导入项目:
New Project > Import project [tab] > GitLab.com [button]
然后从连接到我的帐户的存储库列表中选择要导入的存储库。
有没有办法将存储库的Wiki从Gitlab.com迁移到GitLab CE实例?