(session: nox.Session)
| 33 | @nox.session(name="tests-randomorder") |
| 34 | @nox.session(name="tests-nocoverage") |
| 35 | def tests(session: nox.Session) -> None: |
| 36 | extras = "test" |
| 37 | if session.name == "tests-ssh": |
| 38 | extras += ",ssh" |
| 39 | if session.name == "tests-randomorder": |
| 40 | extras += ",test-randomorder" |
| 41 | |
| 42 | prof_location = ( |
| 43 | pathlib.Path(".") / ".rust-cov" / str(uuid.uuid4()) |
| 44 | ).absolute() |
| 45 | if session.name != "tests-nocoverage": |
| 46 | session.env.update( |
| 47 | { |
| 48 | "RUSTFLAGS": "-Cinstrument-coverage " |
| 49 | + session.env.get("RUSTFLAGS", ""), |
| 50 | "LLVM_PROFILE_FILE": str(prof_location / "cov-%p.profraw"), |
| 51 | } |
| 52 | ) |
| 53 | |
| 54 | install(session, f".[{extras}]") |
| 55 | install(session, "-e", "./vectors") |
| 56 | |
| 57 | session.run("pip", "list") |
| 58 | |
| 59 | if session.name != "tests-nocoverage": |
| 60 | cov_args = [ |
| 61 | "--cov=cryptography", |
| 62 | "--cov=tests", |
| 63 | ] |
| 64 | else: |
| 65 | cov_args = [] |
| 66 | |
| 67 | session.run( |
| 68 | "pytest", |
| 69 | "-n", |
| 70 | "auto", |
| 71 | "--dist=worksteal", |
| 72 | *cov_args, |
| 73 | "--durations=10", |
| 74 | *session.posargs, |
| 75 | "tests/", |
| 76 | ) |
| 77 | |
| 78 | if session.name != "tests-nocoverage": |
| 79 | [rust_so] = glob.glob( |
| 80 | f"{session.virtualenv.location}/**/cryptography/hazmat/bindings/_rust.*", |
| 81 | recursive=True, |
| 82 | ) |
| 83 | process_rust_coverage(session, [rust_so], prof_location) |
| 84 | |
| 85 | |
| 86 | @nox.session |
nothing calls this directly
no test coverage detected