Skip to content

Commit 26a0709

Browse files
committed
fiddle around with tree testing
1 parent fb64314 commit 26a0709

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

chapter_08_prettification.asciidoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ lists
320320
├── static
321321
│   └── bootstrap
322322
│   ├── css
323-
│   │   ├── bootstrap.css
324-
│   │   ├── bootstrap.css.map
323+
│   │   ├── bootstrap-grid.css
324+
│   │   ├── bootstrap-grid.css.map
325325
│   │   ├── [...]
326-
│   │   └── bootstrap-utilities.rtl.min.css.map
326+
│   │   └── bootstrap.rtl.min.css.map
327327
│   └── js
328328
│   ├── bootstrap.bundle.js
329329
│   ├── bootstrap.bundle.js.map
@@ -1046,9 +1046,9 @@ static/
10461046
│   └── xregexp.min.js
10471047
└── bootstrap
10481048
├── css
1049-
│   ├── bootstrap.css
1049+
│   ├── bootstrap-grid.css
10501050
│   ├── [...]
1051-
│ └── bootstrap-utilities.rtl.min.css.map
1051+
│ └── bootstrap.rtl.min.css.map
10521052
└── js
10531053
├── bootstrap.bundle.js
10541054
├── [...]

tests/book_tester.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,13 @@ def replace_command_with_check(self, pos, old, new):
458458
setattr(new_listing, attr, val)
459459
self.listings[pos] = new_listing
460460

461-
def _run_tree(self, target=""):
461+
def _run_tree(self, target="", no_report=False):
462462
return self.sourcetree.run_command(
463-
f"tree -v -I __pycache__ --noreport {target}"
463+
f"tree -v -I __pycache__ {'--noreport' if no_report else ''} {target}"
464464
)
465465

466466
def assert_directory_tree_correct(self, expected_tree):
467-
actual_tree = self._run_tree()
467+
actual_tree = self._run_tree(no_report=True)
468468
self.assert_console_output_correct(actual_tree, expected_tree)
469469

470470
def assert_all_listings_checked(self, listings, exceptions=[]):
@@ -847,15 +847,14 @@ def recognise_listing_and_process_it(self):
847847
ls = listing.startswith("ls")
848848
self.assert_console_output_correct(output, next_listing, ls=ls)
849849
next_listing.was_checked = True
850-
listing.was_checked = True
851850
self.pos += 2
852851
elif "tree" in listing and next_listing.type == "tree":
853852
assert listing.startswith("tree")
854853
_, _, target = listing.partition("tree")
855854
output = self._run_tree(target=target)
855+
listing.was_run = True
856856
self.assert_console_output_correct(output, next_listing)
857857
next_listing.was_checked = True
858-
listing.was_checked = True
859858
self.pos += 2
860859
else:
861860
self.run_command(listing, ignore_errors=listing.ignore_errors)

0 commit comments

Comments
 (0)