Skip to content

Commit

Permalink
tests: fix pytest cases warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hfudev committed Dec 8, 2023
1 parent 49c88ef commit b03813c
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/test_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def test_manifest_rootpath_chdir(self):

# manifest folder invalid
os.chdir(test_dir)
assert find_apps(str(test_dir), 'esp32', recursive=True, manifest_files=str(yaml_file))
with pytest.warns(
UserWarning, match=f'Folder "{IDF_PATH}/examples/get-started/examples/get-started" does not exist'
):
assert find_apps(str(test_dir), 'esp32', recursive=True, manifest_files=str(yaml_file))

def test_manifest_rootpath_specified(self):
test_dir = IDF_PATH / 'examples' / 'get-started'
Expand All @@ -56,10 +59,10 @@ def test_manifest_rootpath_specified(self):
''',
encoding='utf8',
)

assert find_apps(
str(test_dir), 'esp32', recursive=True, manifest_files=str(yaml_file), manifest_rootpath=str(IDF_PATH)
)
with pytest.warns(UserWarning, match=f'Folder "{IDF_PATH}/get-started" does not exist.'):
assert find_apps(
str(test_dir), 'esp32', recursive=True, manifest_files=str(yaml_file), manifest_rootpath=str(IDF_PATH)
)

assert not find_apps(
str(test_dir),
Expand Down Expand Up @@ -95,13 +98,16 @@ def test_keyword_idf_version(self):
yaml_file = test_dir / 'test.yml'
yaml_file.write_text(
'''
get-started:
examples/get-started:
enable:
- if: IDF_VERSION_MAJOR > 0 and IDF_VERSION_MINOR < 999 and IDF_VERSION_PATCH in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
''',
encoding='utf8',
)
assert find_apps(str(test_dir), 'esp32', recursive=True, manifest_files=str(yaml_file)) == apps
assert (
find_apps(str(test_dir), 'esp32', recursive=True, manifest_rootpath=IDF_PATH, manifest_files=str(yaml_file))
== apps
)


class TestFindWithModifiedFilesComponents:
Expand Down

0 comments on commit b03813c

Please sign in to comment.