| 471 | |
| 472 | |
| 473 | def setuptestfs(path): |
| 474 | if path.join(class="st">"samplefile").check(): |
| 475 | return |
| 476 | class="cm"># print class="st">"setting up test fs for", repr(path) |
| 477 | samplefile = path.ensure(class="st">"samplefile") |
| 478 | samplefile.write_text(class="st">"samplefile\n", encoding=class="st">"utf-8") |
| 479 | |
| 480 | execfile = path.ensure(class="st">"execfile") |
| 481 | execfile.write_text(class="st">"x=42", encoding=class="st">"utf-8") |
| 482 | |
| 483 | execfilepy = path.ensure(class="st">"execfile.py") |
| 484 | execfilepy.write_text(class="st">"x=42", encoding=class="st">"utf-8") |
| 485 | |
| 486 | d = {1: 2, class="st">"hello": class="st">"world", class="st">"answer": 42} |
| 487 | path.ensure(class="st">"samplepickle").dump(d) |
| 488 | |
| 489 | sampledir = path.ensure(class="st">"sampledir", dir=1) |
| 490 | sampledir.ensure(class="st">"otherfile") |
| 491 | |
| 492 | otherdir = path.ensure(class="st">"otherdir", dir=1) |
| 493 | otherdir.ensure(class="st">"__init__.py") |
| 494 | |
| 495 | module_a = otherdir.ensure(class="st">"a.py") |
| 496 | module_a.write_text(class="st">"from .b import stuff as result\n", encoding=class="st">"utf-8") |
| 497 | module_b = otherdir.ensure(class="st">"b.py") |
| 498 | module_b.write_text(&class="cm">#x27;stuff=class="st">"got it"\n', encoding=class="st">"utf-8") |
| 499 | module_c = otherdir.ensure(class="st">"c.py") |
| 500 | module_c.write_text( |
| 501 | class="st">"""import py; |
| 502 | import otherdir.a |
| 503 | value = otherdir.a.result |
| 504 | class="st">""", |
| 505 | encoding=class="st">"utf-8", |
| 506 | ) |
| 507 | module_d = otherdir.ensure(class="st">"d.py") |
| 508 | module_d.write_text( |
| 509 | class="st">"""import py; |
| 510 | from otherdir import a |
| 511 | value2 = a.result |
| 512 | class="st">""", |
| 513 | encoding=class="st">"utf-8", |
| 514 | ) |
| 515 | |
| 516 | |
| 517 | win32only = pytest.mark.skipif( |