diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bf67d06..2274cd8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a21a21..f797301 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,10 +15,10 @@ jobs: python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/docs/changelog.rst b/docs/changelog.rst index 8b83efb..8b1402e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,9 @@ newest changes first. 0.18.x ------ +* v0.18.1 + * Do not index sample programs that do not correspond to a valid project. + * v0.18.0 * Add ability to get information about untestable languages. * Indicate support for python 3.11. diff --git a/setup.py b/setup.py index f17fe97..c1d334f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ MAJOR = 0 MINOR = 18 -PATCH = 0 +PATCH = 1 name = "subete" version = f"{MAJOR}.{MINOR}" diff --git a/subete/repo.py b/subete/repo.py index df35019..8214e2a 100644 --- a/subete/repo.py +++ b/subete/repo.py @@ -761,7 +761,11 @@ def _collect_sample_programs(self) -> Dict[str, SampleProgram]: _, file_ext = os.path.splitext(file) file_ext = file_ext.lower() if file_ext not in (".md", "", ".yml"): - program = SampleProgram(self._path, file, self) + try: + program = SampleProgram(self._path, file, self) + except KeyError: + continue + sample_programs[program.project_name()] = program logger.debug(f"New sample program collected: {program}") sample_programs = dict(sorted(sample_programs.items())) @@ -860,7 +864,10 @@ def __init__(self, path: str, file_name: str, language: LanguageCollection) -> N self._path: str = path self._file_name: str = file_name self._language: LanguageCollection = language - self._project: Project = self._generate_project() + self._project: Optional[Project] = self._generate_project() + if not self._project: + raise KeyError(f"Project cannot be found for {file_name}") + self._sample_program_doc_url: str = self._generate_doc_url() self._sample_program_issue_url: str = self._generate_issue_url() self._line_count: int = len(self.code().splitlines()) diff --git a/tests/test_integration_for_bad_repo.py b/tests/test_integration_for_bad_repo.py index c283bfe..823d774 100644 --- a/tests/test_integration_for_bad_repo.py +++ b/tests/test_integration_for_bad_repo.py @@ -16,7 +16,7 @@ def test_bad_repo_languages(bad_test_repo): def test_bad_repo_total_programs(bad_test_repo): - assert bad_test_repo.total_programs() == 1 + assert bad_test_repo.total_programs() == 0 def test_bad_repo_total_tests(bad_test_repo):