From 1bd950ed712b8a70bba91c771c5b52ed08a5465a Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Thu, 5 Apr 2018 19:44:19 +0300 Subject: [PATCH] PY-29371: Sync with teamcity(#176): purge tests on "scenario" call When some scenarios are skipped due to tags, behave reports their steps but never reports "match" for them. So, on next "match" stale (ignored actually) step is left on stack and used instead of real one --- .../helpers/pycharm/teamcity/jb_behave_formatter.py | 1 + .../com/jetbrains/env/SMRootTestsCounter.java | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/python/helpers/pycharm/teamcity/jb_behave_formatter.py b/python/helpers/pycharm/teamcity/jb_behave_formatter.py index a6efbe9abf7e..2e300076accc 100644 --- a/python/helpers/pycharm/teamcity/jb_behave_formatter.py +++ b/python/helpers/pycharm/teamcity/jb_behave_formatter.py @@ -55,6 +55,7 @@ class TeamcityFormatter(Formatter): assert isinstance(scenario, Scenario) self.__scenario = scenario self.__scenario_opened = False + self.__steps.clear() def step(self, step): assert isinstance(step, Step) diff --git a/python/testSrc/com/jetbrains/env/SMRootTestsCounter.java b/python/testSrc/com/jetbrains/env/SMRootTestsCounter.java index 0fafa9431e6c..4ca3971422bd 100644 --- a/python/testSrc/com/jetbrains/env/SMRootTestsCounter.java +++ b/python/testSrc/com/jetbrains/env/SMRootTestsCounter.java @@ -22,9 +22,10 @@ import org.jetbrains.annotations.NotNull; /** * Provides high level API for number of tests calculations in {@link SMTestProxy} + * * @author Ilya.Kazakevich */ -final class SMRootTestsCounter { +public final class SMRootTestsCounter { /** * Filter to exclude suites */ @@ -41,7 +42,7 @@ final class SMRootTestsCounter { /** * @param testProxy proxy to wrap */ - SMRootTestsCounter(@NotNull final SMRootTestProxy testProxy) { + public SMRootTestsCounter(@NotNull final SMRootTestProxy testProxy) { myTestProxy = testProxy; } @@ -53,18 +54,18 @@ final class SMRootTestsCounter { /** * @return number of failed tests */ - int getFailedTestsCount() { + public int getFailedTestsCount() { return myTestProxy.collectChildren(NOT_SUIT.and(Filter.FAILED_OR_INTERRUPTED)).size(); } /** * @return number of passed tests */ - int getPassedTestsCount() { + public int getPassedTestsCount() { return myTestProxy.collectChildren(NOT_SUIT.and(Filter.PASSED)).size(); } - int getIgnoredTestsCount() { + public int getIgnoredTestsCount() { return myTestProxy.collectChildren(NOT_SUIT.and(Filter.IGNORED)).size(); } @@ -72,7 +73,7 @@ final class SMRootTestsCounter { /** * @return number of all tests */ - int getAllTestsCount() { + public int getAllTestsCount() { return myTestProxy.collectChildren(NOT_SUIT).size(); } }