File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 48
48
with :
49
49
python-version : " 3.x"
50
50
51
+ - name : Install Rust toolchain
52
+ uses : actions-rs/toolchain@v1
53
+ with :
54
+ toolchain : stable
55
+ profile : minimal
56
+ default : true
57
+
51
58
- run : pip install nox
52
59
53
60
- run : nox -s test
Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+
3
+ import pytest
4
+ from pytest import CaptureFixture , MonkeyPatch
5
+
6
+ from setuptools_rust .extension import RustBin
7
+
8
+
9
+ @pytest .fixture ()
10
+ def hello_world_bin () -> RustBin :
11
+ setuptools_rust_dir = Path (__file__ ).parent .parent
12
+ return RustBin (
13
+ "hello-world" ,
14
+ path = (
15
+ setuptools_rust_dir / "examples" / "hello-world" / "Cargo.toml"
16
+ ).as_posix (),
17
+ )
18
+
19
+
20
+ def test_metadata_contents (hello_world_bin : RustBin ) -> None :
21
+ metadata = hello_world_bin ._metadata (quiet = False )
22
+ assert "target_directory" in metadata
23
+
24
+
25
+ def test_metadata_cargo_log (
26
+ capfd : CaptureFixture , monkeypatch : MonkeyPatch , hello_world_bin : RustBin
27
+ ) -> None :
28
+ monkeypatch .setenv ("CARGO_LOG" , "trace" )
29
+
30
+ # With quiet unset, no stdout, plenty of logging stderr
31
+ hello_world_bin ._metadata (quiet = False )
32
+ captured = capfd .readouterr ()
33
+ assert captured .out == ""
34
+ assert "TRACE cargo::util::config" in captured .err
35
+
36
+ # With quiet set, nothing will be printed
37
+ hello_world_bin ._metadata (quiet = True )
38
+ captured = capfd .readouterr ()
39
+ assert captured .out == ""
40
+ assert captured .err == ""
You can’t perform that action at this time.
0 commit comments