Skip to content

Commit 5c1ebc7

Browse files
fix mypy issues and config
1 parent 272e3c4 commit 5c1ebc7

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

mypy.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[mypy]
22
python_version = 3.12
33
files = tests, examples
4+
exclude = ^(build|external|working|\.venv-psim)([\\/]|$)
45
warn_unused_configs = True
56
check_untyped_defs = True
67
no_implicit_optional = True

tests/unit/config_parser_test.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class TempConfigFile {
1616
public:
1717
explicit TempConfigFile(const std::string &yaml_body) {
1818
static std::atomic<unsigned long long> counter{0ULL};
19-
const auto nonce = std::chrono::steady_clock::now().time_since_epoch().count();
19+
const auto nonce =
20+
std::chrono::steady_clock::now().time_since_epoch().count();
2021
const auto id = counter.fetch_add(1ULL, std::memory_order_relaxed);
2122

2223
path_ = std::filesystem::temp_directory_path() /
@@ -25,12 +26,14 @@ class TempConfigFile {
2526

2627
std::ofstream out(path_);
2728
if (!out.is_open()) {
28-
throw std::runtime_error("failed to create temp config: " + path_.string());
29+
throw std::runtime_error("failed to create temp config: " +
30+
path_.string());
2931
}
3032
out << yaml_body;
3133
out.flush();
3234
if (!out.good()) {
33-
throw std::runtime_error("failed to write temp config: " + path_.string());
35+
throw std::runtime_error("failed to write temp config: " +
36+
path_.string());
3437
}
3538
}
3639

@@ -54,7 +57,8 @@ void expect_config_error(const std::string &yaml_body,
5457
} catch (const std::runtime_error &e) {
5558
const std::string message = e.what();
5659
EXPECT_NE(message.find(expected_token), std::string::npos)
57-
<< "expected token: " << expected_token << "\nactual message: " << message;
60+
<< "expected token: " << expected_token
61+
<< "\nactual message: " << message;
5862
}
5963
}
6064

@@ -130,7 +134,8 @@ TEST(ConfigParserTest, RejectsUnknownSimulationKey) {
130134
}
131135

132136
TEST(ConfigParserTest, RejectsAmbientSignalPathWithoutAmbientTemperature) {
133-
expect_config_error(R"(
137+
expect_config_error(
138+
R"(
134139
devices:
135140
- id: tempctl0
136141
type: tempctl
@@ -140,7 +145,7 @@ TEST(ConfigParserTest, RejectsAmbientSignalPathWithoutAmbientTemperature) {
140145
physics_config: physics.yaml
141146
ambient_signal_path: environment/ambient_temp
142147
)",
143-
"simulation.ambient_signal_path requires simulation.ambient_temp_c");
148+
"simulation.ambient_signal_path requires simulation.ambient_temp_c");
144149
}
145150

146151
TEST(ConfigParserTest, RejectsInvalidStartupPolicyValue) {

0 commit comments

Comments
 (0)