Cache now obeys -q when showing summary for --lf and --ff
Related to #3853
This commit is contained in:
		
							parent
							
								
									a31967431f
								
							
						
					
					
						commit
						47bb53f5cb
					
				| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					Cache plugin now obeys the ``-q`` flag when ``--last-failed`` and ``--failed-first`` flags are used.
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ class LFPlugin(object):
 | 
				
			||||||
        self._no_failures_behavior = self.config.getoption("last_failed_no_failures")
 | 
					        self._no_failures_behavior = self.config.getoption("last_failed_no_failures")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def pytest_report_collectionfinish(self):
 | 
					    def pytest_report_collectionfinish(self):
 | 
				
			||||||
        if self.active:
 | 
					        if self.active and self.config.getoption("verbose") >= 0:
 | 
				
			||||||
            if not self._previously_failed_count:
 | 
					            if not self._previously_failed_count:
 | 
				
			||||||
                mode = "run {} (no recorded failures)".format(
 | 
					                mode = "run {} (no recorded failures)".format(
 | 
				
			||||||
                    self._no_failures_behavior
 | 
					                    self._no_failures_behavior
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -559,6 +559,19 @@ class TestLastFailed(object):
 | 
				
			||||||
        testdir.runpytest("-q", "--lf")
 | 
					        testdir.runpytest("-q", "--lf")
 | 
				
			||||||
        assert os.path.exists(".pytest_cache/v/cache/lastfailed")
 | 
					        assert os.path.exists(".pytest_cache/v/cache/lastfailed")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @pytest.mark.parametrize("quiet", [True, False])
 | 
				
			||||||
 | 
					    @pytest.mark.parametrize("opt", ["--ff", "--lf"])
 | 
				
			||||||
 | 
					    def test_lf_and_ff_obey_verbosity(self, quiet, opt, testdir):
 | 
				
			||||||
 | 
					        testdir.makepyfile("def test(): pass")
 | 
				
			||||||
 | 
					        args = [opt]
 | 
				
			||||||
 | 
					        if quiet:
 | 
				
			||||||
 | 
					            args.append("-q")
 | 
				
			||||||
 | 
					        result = testdir.runpytest(*args)
 | 
				
			||||||
 | 
					        if quiet:
 | 
				
			||||||
 | 
					            assert "run all" not in result.stdout.str()
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            assert "run all" in result.stdout.str()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_xfail_not_considered_failure(self, testdir):
 | 
					    def test_xfail_not_considered_failure(self, testdir):
 | 
				
			||||||
        testdir.makepyfile(
 | 
					        testdir.makepyfile(
 | 
				
			||||||
            """
 | 
					            """
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue