是否可以增加Sublime Text 3(Ubuntu)中文件 - >打开最近菜单中出现的最近文件的数量?
我已经阅读过Sublime Text 2中最近项目的增加数量?
我在我的电脑上找不到这个〜/ Library文件夹.我可以找到〜/ .config/sublime-text-3/Packages但是里面没有"Default"子文件夹.
例如,我有一些尝试访问列表的代码:
def some_code():
script_dir = os.path.dirname(sys.argv[0])
Run Code Online (Sandbox Code Playgroud)
我需要嘲笑sys.argv[0]。因此,我添加@patch.object到测试中:
import os
import sys
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
@mock.patch.object(sys, 'argv', mock.Mock(return_value=[THIS_DIR]))
def test_mytest():
some_code()
Run Code Online (Sandbox Code Playgroud)
但这是行不通的。Pytest引发错误:
> script_dir = os.path.dirname(sys.argv[0])
E TypeError: 'Mock' object does not support indexing
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我安装了一个git precommit钩子,有时我想用--no-verifyflag 提交。我知道如何在命令行中执行此操作,但我想在TortoiseGit中执行此操作(因为Windows中的命令行非常差)。我怎样才能做到这一点?我通读了https://tortoisegit.org/docs/tortoisegit/tgit-dug-commit.html,但找不到任何有用的信息。
我有2个测试类:MyTest1和MyTest2。它们都具有相同的标头并测试相同的类,但是它们测试该类的2个非常不同的方面(您可能会因此批评我,但让我们不在此讨论):
@RunWith(LocalRobolectricTestRunner.class)
@Config(manifest = RobolectricTestData.AndroidManifestFileName)
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@PowerMockIgnore({ "org.mockito.*", "org.robolectric.*", "android.*" })
@PrepareForTest(MyStrangeClassWithStaticMethods.class)
@ParametersAreNonnullByDefault
public class MyTest1 extends MyBaseTest {
// This is to dinamically load PowerMock. We can't use PowerMockRunner because we already use
// RobolectricTestRunner and PowerMockRunner doesn't do robolectric's stuff.
@Rule
public final PowerMockRule rule = new PowerMockRule();
/**
* Tests set up.
*/
@Before
public final void setUp() throws Exception {
super.setUp();
}
public void testSomething() {
PowerMockito.mockStatic(MyStrangeClassWithStaticMethods.class);
// do some stuff
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我可以单独运行MyTest1并且所有测试都可以。我可以单独运行MyTest2,所有测试都可以。但是,当我同时运行MyTest1和MyTest2的所有测试(它们都编译到一个jar中)时,只有第一个运行类(MyTest1)可以正常运行,而第二个类则失败。所有测试都因以下异常而崩溃:
org.mockito.exceptions.base.MockitoException:
ClassCastException …Run Code Online (Sandbox Code Playgroud) unit-testing ×2
commit ×1
git ×1
java ×1
mocking ×1
powermock ×1
pytest ×1
python ×1
python-mock ×1
robolectric ×1
sublimetext3 ×1
tortoisegit ×1
windows ×1