File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //! Integration tests for the `graph` command.
2+ use muse2:: cli:: { GraphOpts , handle_graph_command} ;
3+ use muse2:: log:: is_logger_initialised;
4+ use muse2:: settings:: Settings ;
5+ use std:: path:: PathBuf ;
6+ use tempfile:: tempdir;
7+
8+ /// Get the path to the example model.
9+ fn get_model_dir ( ) -> PathBuf {
10+ PathBuf :: from ( "examples/simple" )
11+ }
12+
13+ /// An integration test for the `graph` command.
14+ ///
15+ /// We also check that the logger is initialised after it is run.
16+ #[ test]
17+ fn test_handle_graph_command ( ) {
18+ unsafe { std:: env:: set_var ( "MUSE2_LOG_LEVEL" , "off" ) } ;
19+
20+ assert ! ( !is_logger_initialised( ) ) ;
21+
22+ // Save results to non-existent directory to check that directory creation works
23+ let tempdir = tempdir ( ) . unwrap ( ) ;
24+ let output_dir = tempdir. path ( ) . join ( "results" ) ;
25+ let opts = GraphOpts {
26+ output_dir : Some ( output_dir) ,
27+ overwrite : false ,
28+ } ;
29+ handle_graph_command ( & get_model_dir ( ) , & opts, Some ( Settings :: default ( ) ) ) . unwrap ( ) ;
30+
31+ assert ! ( is_logger_initialised( ) ) ;
32+ }
You can’t perform that action at this time.
0 commit comments