TermStatusLine: fix python 2.7 and add test (#28715)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
		| @@ -683,7 +683,7 @@ def clear(self): | |||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
|         self.pkg_set.clear() |         self.pkg_set.clear() | ||||||
|         self.pkg_list.clear() |         self.pkg_list = [] | ||||||
| 
 | 
 | ||||||
|         # Move the cursor to the beginning of the first "Waiting for" message and clear |         # Move the cursor to the beginning of the first "Waiting for" message and clear | ||||||
|         # everything after it. |         # everything after it. | ||||||
|   | |||||||
| @@ -1272,3 +1272,14 @@ def remove(self, spec): | |||||||
|     # Make sure that `remove` was called on the database after an unsuccessful |     # Make sure that `remove` was called on the database after an unsuccessful | ||||||
|     # attempt to restore the backup. |     # attempt to restore the backup. | ||||||
|     assert fake_db.called |     assert fake_db.called | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def test_term_status_line(): | ||||||
|  |     # Smoke test for TermStatusLine; to actually test output it would be great | ||||||
|  |     # to pass a StringIO instance, but we use tty.msg() internally which does not | ||||||
|  |     # accept that. `with log_output(buf)` doesn't really work because it trims output | ||||||
|  |     # and we actually want to test for escape sequences etc. | ||||||
|  |     x = inst.TermStatusLine(enabled=True) | ||||||
|  |     x.add("a") | ||||||
|  |     x.add("b") | ||||||
|  |     x.clear() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Harmen Stoppels
					Harmen Stoppels