Skip to content

Commit

Permalink
test: moved test to esp_bool_parser
Browse files Browse the repository at this point in the history
  • Loading branch information
horw committed Jan 7, 2025
1 parent 4bf0a73 commit 1485eaf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
20 changes: 0 additions & 20 deletions tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

import pytest
import yaml
from esp_bool_parser import parse_bool_expr
from packaging.version import (
Version,
)

import idf_build_apps
from idf_build_apps import setup_logging
Expand Down Expand Up @@ -509,14 +505,6 @@ def test_manifest_diff_sha(tmp_path, sha_of_enable_only_esp32):


class TestIfParser:
def test_idf_version(self, monkeypatch):
monkeypatch.setattr(idf_build_apps.manifest.if_parser, 'IDF_VERSION', Version('5.9.0'))
statement = 'IDF_VERSION > "5.10.0"'
assert parse_bool_expr(statement).get_value('esp32', 'foo') is False

statement = 'IDF_VERSION in ["5.9.0"]'
assert parse_bool_expr(statement).get_value('esp32', 'foo') is True

def test_invalid_if_statement(self):
statement = '1'
with pytest.raises(InvalidIfClause, match='Invalid if clause: 1'):
Expand All @@ -525,11 +513,3 @@ def test_invalid_if_statement(self):
def test_temporary_must_with_reason(self):
with pytest.raises(InvalidIfClause, match='"reason" must be set when "temporary: true"'):
IfClause(stmt='IDF_TARGET == "esp32"', temporary=True)


def test_consecutive_or_and_stml_manifest():
with pytest.raises(InvalidIfClause, match='Chaining "and"/"or" is not allowed'):
IfClause(stmt='IDF_TARGET == "esp32" or IDF_TARGET == "esp32c3" or IDF_TARGET == "esp32s3"')

with pytest.raises(InvalidIfClause, match='Chaining "and"/"or" is not allowed'):
IfClause(stmt='IDF_TARGET == "esp32" or IDF_TARGET == "esp32c3" and IDF_TARGET == "esp32s3"')
16 changes: 1 addition & 15 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import os
import shutil
from pathlib import (
Path,
)
Expand Down Expand Up @@ -143,16 +142,3 @@ def test_files_matches_patterns(tmp_path):
os.chdir(temp_dir)
for f in matched_files:
assert files_matches_patterns(f, abs_pat)


@pytest.mark.skipif(not shutil.which('idf.py'), reason='idf.py not found')
def test_idf_version_keywords_type():
from idf_build_apps.constants import (
IDF_VERSION_MAJOR,
IDF_VERSION_MINOR,
IDF_VERSION_PATCH,
)

assert isinstance(IDF_VERSION_MAJOR, int)
assert isinstance(IDF_VERSION_MINOR, int)
assert isinstance(IDF_VERSION_PATCH, int)

0 comments on commit 1485eaf

Please sign in to comment.