Stranger6667/jsonschema

Test compile error: `custom attribute panicked`

Closed this issue · 2 comments

After fixing #444 in similar way as proposed, cargo test in jsonschema lib reveals following problem as below.

I use Rust 1.75.0.

warning: `jsonschema` (lib test) generated 32 warnings (32 duplicates)
error: custom attribute panicked
 --> tests/test_suite.rs:5:1
  |
5 | #[json_schema_test_suite("tests/suite", "draft4", {"optional_bignum_0_0", "optional_bignum_2_0"})]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: Tests directory not found: tests/suite/tests/draft4

warning: unused import: `TestCase`
 --> tests/test_suite.rs:1:54
  |
1 | use json_schema_test_suite::{json_schema_test_suite, TestCase};
  |                                                      ^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `Draft`
 --> tests/test_suite.rs:2:18
  |
2 | use jsonschema::{Draft, JSONSchema};
  |                  ^^^^^

warning: `jsonschema` (test "test_suite") generated 2 warnings
error: could not compile `jsonschema` (test "test_suite") due to previous error; 2 warnings emitted

The same error can be observed in jsonschema-test-suite:

error: custom attribute panicked
 --> tests/no-op.rs:3:1
  |
3 | #[json_schema_test_suite("path/to/JSON-Schema-Test-Suite/repository", "draft7")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: Tests directory not found: path/to/JSON-Schema-Test-Suite/repository/tests/draft7

warning: unused import: `TestCase`
 --> tests/no-op.rs:1:54
  |
1 | use json_schema_test_suite::{json_schema_test_suite, TestCase};
  |                                                      ^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error: custom attribute panicked
 --> tests/introduce-failure.rs:3:1
  |
3 | #[json_schema_test_suite("path/to/JSON-Schema-Test-Suite/repository", "draft7", {"ref_0_0", r"optional_format_regex_0_\d+"})]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: Tests directory not found: path/to/JSON-Schema-Test-Suite/repository/tests/draft7

warning: unused import: `TestCase`
 --> tests/introduce-failure.rs:1:54
  |
1 | use json_schema_test_suite::{json_schema_test_suite, TestCase};
  |                                                      ^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

I clarified the error message for it and also, the README now contains a minimal HOWTO on running tests