testing

Python Testing - Reset all mocks?

邮差的信 提交于 2021-02-06 11:25:12
问题 When doing unit-testing with Python / PyTest, if you do you not have patch decorators or with patch blocks throughout your code, is there a way to reset all mocks at the end of every file / module to avoid inter-file test pollution? It seems like something that is mocked in one Python test file remains mocked in other file with the same return value, which means my mocks are persisting between tests and files (when a patch decorator or with patch block is NOT used). Is there any way around

Python Testing - Reset all mocks?

点点圈 提交于 2021-02-06 11:25:12
问题 When doing unit-testing with Python / PyTest, if you do you not have patch decorators or with patch blocks throughout your code, is there a way to reset all mocks at the end of every file / module to avoid inter-file test pollution? It seems like something that is mocked in one Python test file remains mocked in other file with the same return value, which means my mocks are persisting between tests and files (when a patch decorator or with patch block is NOT used). Is there any way around

Fake X server for testing?

和自甴很熟 提交于 2021-02-06 10:03:26
问题 At work we fully test the GUI components. The problem arises from the fact that, while the testsuite is running, the various components pop up, stealing the focus or making it impossible to continue working. The first thing I thought of was Xnest, but I was wondering if there's a more elegant solution to this problem. 回答1: I think what you need to do here is have your tests run on a different Display than the one you're working on. When we moved our TeamCity agents to EC2, we had to figure

JUnit4 - AssertionFailedError: No tests found

…衆ロ難τιáo~ 提交于 2021-02-06 06:55:59
问题 I'm using AndroidJUnitRunner with Espresso. I wrote a simple test but always receive this exception. According to Stackoverflow answers, the problem is messing up the JUnit3 and JUnit4 but I have never used JUnit3 in my project. junit.framework.AssertionFailedError: No tests found in com.walletsaver.app.test.espresso.SignUpPopupTest package com.walletsaver.app.test.espresso; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android

JUnit4 - AssertionFailedError: No tests found

牧云@^-^@ 提交于 2021-02-06 06:49:07
问题 I'm using AndroidJUnitRunner with Espresso. I wrote a simple test but always receive this exception. According to Stackoverflow answers, the problem is messing up the JUnit3 and JUnit4 but I have never used JUnit3 in my project. junit.framework.AssertionFailedError: No tests found in com.walletsaver.app.test.espresso.SignUpPopupTest package com.walletsaver.app.test.espresso; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

一曲冷凌霜 提交于 2021-02-06 03:48:11
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

烂漫一生 提交于 2021-02-06 03:47:55
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

邮差的信 提交于 2021-02-06 03:47:44
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

北城以北 提交于 2021-02-06 03:47:22
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

风流意气都作罢 提交于 2021-02-06 03:47:12
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for