|
15 | 15 | from shutil import rmtree |
16 | 16 | from tempfile import mkdtemp |
17 | 17 | from textwrap import dedent |
| 18 | +from unittest.mock import patch |
18 | 19 | from urllib.parse import urlparse |
19 | 20 | from zipfile import Path as zipfile_path |
20 | 21 | from zipfile import ZipFile |
@@ -291,7 +292,8 @@ def serialise(self, fields=("name", "summary"), recurse=True, format=None): |
291 | 292 | tree.dist = self |
292 | 293 | table = gen_table(tree, cols=cols) |
293 | 294 | buf = io.StringIO() |
294 | | - rich.print(table, file=buf) |
| 295 | + with patch.dict("os.environ", COLUMNS="1000"): |
| 296 | + rich.print(table, file=buf) |
295 | 297 | raw = buf.getvalue() |
296 | 298 | stripped = "\n".join([x.rstrip() for x in raw.splitlines() if x.strip()]) |
297 | 299 | result = dedent(stripped) |
@@ -372,17 +374,18 @@ def gen_tree(johnnydist, with_specifier=True): |
372 | 374 |
|
373 | 375 | def gen_table(tree, cols): |
374 | 376 | table = Table(box=rich.box.SIMPLE) |
375 | | - table.add_column("name", overflow="fold") |
| 377 | + table.add_column("name", overflow="fold", no_wrap=True) |
376 | 378 | for col in cols: |
377 | | - table.add_column(col, overflow="fold") |
| 379 | + table.add_column(col, overflow="fold", no_wrap=True) |
378 | 380 | rows = [] |
379 | 381 | stack = [tree] |
380 | 382 | while stack: |
381 | 383 | node = stack.pop() |
382 | 384 | rows.append(node) |
383 | 385 | stack += reversed(node.children) |
384 | 386 | buf = io.StringIO() |
385 | | - rich.print(tree, file=buf) |
| 387 | + with patch.dict("os.environ", COLUMNS="1000"): |
| 388 | + rich.print(tree, file=buf) |
386 | 389 | tree_lines = buf.getvalue().splitlines() |
387 | 390 | for row0, row in zip(tree_lines, rows): |
388 | 391 | data = [getattr(row.dist, c) for c in cols] |
|
0 commit comments