Skip to content

Commit

Permalink
test: app empty name
Browse files Browse the repository at this point in the history
  • Loading branch information
horw committed Dec 15, 2023
1 parent c5e3e38 commit 795cb60
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions idf_build_apps/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ def _expand(self, path):
return path

@property
@lru_cache()
@lru_cache(1)
def name(self) -> str:
base_name = os.path.basename(self.app_dir)
if base_name == '.':
if base_name in '.' or self.app_dir[-1] == '/':
return os.path.basename(os.path.abspath(self.app_dir))
return base_name

Expand Down
15 changes: 15 additions & 0 deletions tests/test_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,21 @@ def test_with_depends_components_but_modified(self, tmp_path, modified_files, co
else:
assert not filtered_apps

def test_app_name_is_not_null(
self,
tmp_path,
):
test_dir = os.path.join(IDF_PATH, 'examples', 'get-started', 'hello_world') + '/'
apps = find_apps(test_dir, 'esp32', recursive=True)
for app in apps:
assert app.name != ''

test_dir = os.path.join(IDF_PATH, 'examples', 'get-started') + '/'

apps = find_apps(test_dir, 'esp32', recursive=True)
for app in apps:
assert app.name != ''

@pytest.mark.parametrize(
'modified_components, modified_files, could_find_apps',
[
Expand Down

0 comments on commit 795cb60

Please sign in to comment.