()
| 905 | |
| 906 | |
| 907 | def _subclass_fork_script() -> str: |
| 908 | return textwrap.dedent( |
| 909 | """ |
| 910 | from __future__ import annotations |
| 911 | |
| 912 | import os |
| 913 | import sys |
| 914 | |
| 915 | from filelock import ReadWriteLock |
| 916 | |
| 917 | class DerivedReadWriteLock(ReadWriteLock): |
| 918 | pass |
| 919 | |
| 920 | lock_path = sys.argv[1] |
| 921 | inherited_lock = DerivedReadWriteLock(lock_path) |
| 922 | child_pid = os.fork() |
| 923 | if child_pid == 0: |
| 924 | if sys.implementation.name == "pypy": |
| 925 | try: |
| 926 | DerivedReadWriteLock(lock_path) |
| 927 | except RuntimeError as error: |
| 928 | assert str(error) == ( |
| 929 | "ReadWriteLock is unavailable in a PyPy fork child; exec or exit before using it" |
| 930 | ) |
| 931 | else: |
| 932 | raise AssertionError("PyPy child constructed a lock after fork") |
| 933 | else: |
| 934 | child_lock = DerivedReadWriteLock(lock_path) |
| 935 | assert child_lock is not inherited_lock |
| 936 | with child_lock.read_lock(): |
| 937 | pass |
| 938 | sys.exit(0) |
| 939 | _, status = os.waitpid(child_pid, 0) |
| 940 | assert os.waitstatus_to_exitcode(status) == 0 |
| 941 | """ |
| 942 | ) |
| 943 | |
| 944 | |
| 945 | def _async_fork_script() -> str: |
no outgoing calls
no test coverage detected