Commit 315c9ac
committed
Very ugly attempt to fix issues with pickling functions for test_doc_examples.py in github CI.
Part 1: run example code by writing it to a file and loading it as a module with importlib instead of using exec.
Part 2: In the example notebook, add PWD to the PYTHONPATH in each remote_info object or dict, counting on the fact that the test framework will chdir to tmp_path, where it wrote the example code as a file (see Part 1) before the example is run, so PWD is the right place for the extracted code's module.
Pickling works locally, but remote jobs are using the global wfl instead of the one in the directory where pytest is being run from. The remoteinfo_env fixture deals with this by modifying the PYTHONPATH in the remote_info env_vars field for other remote run tests, but adding that to the example would make it even uglier than these modifications already do.
Should the RemoteInfo constructor itself be able to add such information (e.g. extra bits for the PYTHONPATH env var) from an env var (maybe something like PYTEST_REMOTE_INFO_EXTRAS, or a more PYTHONPATH specific var name), which pytest can then use without polluting the example itself?1 parent cd52fac commit 315c9ac
File tree
2 files changed
+15
-3
lines changed- docs/source
- tests
2 files changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
247 | | - | |
| 248 | + | |
| 249 | + | |
248 | 250 | | |
249 | 251 | | |
250 | 252 | | |
| |||
464 | 466 | | |
465 | 467 | | |
466 | 468 | | |
| 469 | + | |
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
| |||
548 | 551 | | |
549 | 552 | | |
550 | 553 | | |
551 | | - | |
| 554 | + | |
| 555 | + | |
552 | 556 | | |
553 | 557 | | |
554 | 558 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
| |||
0 commit comments