(case_setup, tmpdir)
| 2740 | |
| 2741 | @pytest.mark.skipif(IS_JYTHON, reason="Not working properly on Jython (needs investigation).") |
| 2742 | def test_debug_zip_files(case_setup, tmpdir): |
| 2743 | def get_environ(writer): |
| 2744 | env = os.environ.copy() |
| 2745 | curr_pythonpath = env.get("PYTHONPATH", "") |
| 2746 | |
| 2747 | curr_pythonpath = str(tmpdir.join("myzip.zip")) + os.pathsep + curr_pythonpath |
| 2748 | curr_pythonpath = str(tmpdir.join("myzip2.egg!")) + os.pathsep + curr_pythonpath |
| 2749 | env["PYTHONPATH"] = curr_pythonpath |
| 2750 | |
| 2751 | env["IDE_PROJECT_ROOTS"] = str(tmpdir.join("myzip.zip")) |
| 2752 | return env |
| 2753 | |
| 2754 | import zipfile |
| 2755 | |
| 2756 | zip_file = zipfile.ZipFile(str(tmpdir.join("myzip.zip")), "w") |
| 2757 | zip_file.writestr("zipped/__init__.py", "") |
| 2758 | zip_file.writestr("zipped/zipped_contents.py", "def call_in_zip():\n return 1") |
| 2759 | zip_file.close() |
| 2760 | |
| 2761 | zip_file = zipfile.ZipFile(str(tmpdir.join("myzip2.egg!")), "w") |
| 2762 | zip_file.writestr("zipped2/__init__.py", "") |
| 2763 | zip_file.writestr("zipped2/zipped_contents2.py", "def call_in_zip2():\n return 1") |
| 2764 | zip_file.close() |
| 2765 | |
| 2766 | with case_setup.test_file("_debugger_case_zip_files.py", get_environ=get_environ) as writer: |
| 2767 | writer.write_add_breakpoint(2, "None", filename=os.path.join(str(tmpdir.join("myzip.zip")), "zipped", "zipped_contents.py")) |
| 2768 | |
| 2769 | writer.write_add_breakpoint(2, "None", filename=os.path.join(str(tmpdir.join("myzip2.egg!")), "zipped2", "zipped_contents2.py")) |
| 2770 | |
| 2771 | writer.write_make_initial_run() |
| 2772 | hit = writer.wait_for_breakpoint_hit() |
| 2773 | assert hit.name == "call_in_zip" |
| 2774 | writer.write_run_thread(hit.thread_id) |
| 2775 | |
| 2776 | hit = writer.wait_for_breakpoint_hit() |
| 2777 | assert hit.name == "call_in_zip2" |
| 2778 | writer.write_run_thread(hit.thread_id) |
| 2779 | |
| 2780 | writer.finished_ok = True |
| 2781 | |
| 2782 | |
| 2783 | @pytest.mark.skipif(not IS_CPYTHON, reason="CPython only test.") |
nothing calls this directly
no test coverage detected