(session: nox.Session)
| 50 | @nox.session(name=class="st">"tests-nocoverage") |
| 51 | @nox.session(name=class="st">"tests-rust-debug") |
| 52 | def tests(session: nox.Session) -> None: |
| 53 | extras = [] |
| 54 | groups = [class="st">"test"] |
| 55 | if session.name == class="st">"tests-ssh": |
| 56 | extras.append(class="st">"ssh") |
| 57 | if session.name == class="st">"tests-randomorder": |
| 58 | groups = [class="st">"test-randomorder"] |
| 59 | |
| 60 | prof_location = ( |
| 61 | pathlib.Path(class="st">".") / class="st">".rust-cov" / str(uuid.uuid4()) |
| 62 | ).absolute() |
| 63 | if session.name != class="st">"tests-nocoverage": |
| 64 | rustflags = os.environ.get(class="st">"RUSTFLAGS", class="st">"") |
| 65 | assert rustflags is not None |
| 66 | session.env.update( |
| 67 | { |
| 68 | class="st">"RUSTFLAGS": fclass="st">"-Cinstrument-coverage {rustflags}", |
| 69 | class="st">"LLVM_PROFILE_FILE": str(prof_location / class="st">"cov-%p.profraw"), |
| 70 | } |
| 71 | ) |
| 72 | |
| 73 | install_spec = fclass="st">".[{&class="cm">#x27;,'.join(extras)}]" |
| 74 | install(session, class="st">"-e", class="st">"./vectors") |
| 75 | if session.name == class="st">"tests-rust-debug": |
| 76 | install( |
| 77 | session, |
| 78 | class="st">"--config-settings-package=cryptography:build-args=--profile=dev", |
| 79 | install_spec, |
| 80 | ) |
| 81 | else: |
| 82 | install(session, install_spec) |
| 83 | |
| 84 | install( |
| 85 | session, |
| 86 | *itertools.chain.from_iterable((class="st">"--group", g) for g in groups), |
| 87 | ) |
| 88 | |
| 89 | session.run(class="st">"uv", class="st">"pip", class="st">"list") |
| 90 | |
| 91 | if session.name != class="st">"tests-nocoverage": |
| 92 | cov_args = [ |
| 93 | class="st">"--cov=cryptography", |
| 94 | class="st">"--cov=tests", |
| 95 | ] |
| 96 | else: |
| 97 | cov_args = [] |
| 98 | |
| 99 | if session.posargs: |
| 100 | tests = session.posargs |
| 101 | else: |
| 102 | tests = [class="st">"tests/"] |
| 103 | |
| 104 | session.run( |
| 105 | class="st">"pytest", |
| 106 | class="st">"-n", |
| 107 | class="st">"auto", |
| 108 | class="st">"--dist=worksteal", |
| 109 | *cov_args, |
nothing calls this directly
no test coverage detected