parent
045230a428
commit
29abcdbe0b
|
@ -800,26 +800,38 @@ class PytestPluginManager(PluginManager):
|
||||||
|
|
||||||
def consider_pluginarg(self, arg: str) -> None:
|
def consider_pluginarg(self, arg: str) -> None:
|
||||||
""":meta private:"""
|
""":meta private:"""
|
||||||
|
# Branch ID 1
|
||||||
if arg.startswith("no:"):
|
if arg.startswith("no:"):
|
||||||
|
branchCoverage[0] = 1
|
||||||
name = arg[3:]
|
name = arg[3:]
|
||||||
|
# Branch ID 2
|
||||||
if name in essential_plugins:
|
if name in essential_plugins:
|
||||||
|
branchCoverage[1] = 1
|
||||||
print(f"UsageError: plugin {name} cannot be disabled")
|
print(f"UsageError: plugin {name} cannot be disabled")
|
||||||
|
|
||||||
# PR #4304: remove stepwise if cacheprovider is blocked.
|
# PR #4304: remove stepwise if cacheprovider is blocked.
|
||||||
|
# Branch ID 3
|
||||||
if name == "cacheprovider":
|
if name == "cacheprovider":
|
||||||
|
branchCoverage[2] = 1
|
||||||
self.set_blocked("stepwise")
|
self.set_blocked("stepwise")
|
||||||
self.set_blocked("pytest_stepwise")
|
self.set_blocked("pytest_stepwise")
|
||||||
|
|
||||||
self.set_blocked(name)
|
self.set_blocked(name)
|
||||||
|
# Branch ID 4
|
||||||
if not name.startswith("pytest_"):
|
if not name.startswith("pytest_"):
|
||||||
|
branchCoverage[3] = 1
|
||||||
self.set_blocked("pytest_" + name)
|
self.set_blocked("pytest_" + name)
|
||||||
|
|
||||||
|
# Branch ID 5
|
||||||
else:
|
else:
|
||||||
|
branchCoverage[4] = 1
|
||||||
name = arg
|
name = arg
|
||||||
# Unblock the plugin.
|
# Unblock the plugin.
|
||||||
self.unblock(name)
|
self.unblock(name)
|
||||||
|
|
||||||
|
# Branch ID 6
|
||||||
if not name.startswith("pytest_"):
|
if not name.startswith("pytest_"):
|
||||||
|
branchCoverage[5] = 1
|
||||||
self.unblock("pytest_" + name)
|
self.unblock("pytest_" + name)
|
||||||
self.import_plugin(arg, consider_entry_points=True)
|
self.import_plugin(arg, consider_entry_points=True)
|
||||||
|
|
||||||
|
@ -1979,3 +1991,42 @@ def apply_warning_filters(
|
||||||
|
|
||||||
for arg in cmdline_filters:
|
for arg in cmdline_filters:
|
||||||
warnings.filterwarnings(*parse_warning_filter(arg, escape=True))
|
warnings.filterwarnings(*parse_warning_filter(arg, escape=True))
|
||||||
|
|
||||||
|
branchCoverage = [0,0,0,0,0,0]
|
||||||
|
i = 1
|
||||||
|
for x in branchCoverage:
|
||||||
|
print("Branch " + str(i) + " was reached: "+ str(x))
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
# Cover branches 1,2,4
|
||||||
|
print("Given input: no:mark")
|
||||||
|
branchCoverage = [0,0,0,0,0,0]
|
||||||
|
something = PytestPluginManager()
|
||||||
|
something.consider_pluginarg("no:mark")
|
||||||
|
|
||||||
|
i = 1
|
||||||
|
for x in branchCoverage:
|
||||||
|
print("Branch " + str(i) + " was reached: "+ str(x))
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
print()
|
||||||
|
|
||||||
|
# Cover branches 1,3,4
|
||||||
|
print("Given input: no:cacheprovider")
|
||||||
|
branchCoverage = [0,0,0,0,0,0]
|
||||||
|
something.consider_pluginarg("no:cacheprovider")
|
||||||
|
i = 1
|
||||||
|
for x in branchCoverage:
|
||||||
|
print("Branch " + str(i) + " was reached: "+ str(x))
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
print()
|
||||||
|
|
||||||
|
# Cover branches 5,6
|
||||||
|
print("Given input: mark")
|
||||||
|
branchCoverage = [0,0,0,0,0,0]
|
||||||
|
something.consider_pluginarg("mark")
|
||||||
|
i = 1
|
||||||
|
for x in branchCoverage:
|
||||||
|
print("Branch " + str(i) + " was reached: "+ str(x))
|
||||||
|
i = i + 1
|
Loading…
Reference in New Issue