Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
name: pytest

on:
pull_request:
branches: ['main']

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up Python environment
uses: actions/setup-python@v5

- name: Install dependencies
run: |
pip install pyaml pytest

- name: Run tests
run: |
pytest
env:
GH_TOKEN: ${{ github.token }}
2 changes: 1 addition & 1 deletion gateway/test_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_update_refs():
},
"dorny/paths-filter": {
"0bc4621a3135347011ad047f9ecf449bf72ce2bd": {
"expires_at": calculate_expiry()
"expires_at": calculate_expiry(12)
},
"de90cc6fb38fc0963ad72b210f1f284cd68cea36": {
"expires_at": datetime.date(2100, 1, 1),
Expand Down
4 changes: 3 additions & 1 deletion stash/restore/test_get_stash.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import unittest
import json
import os

from get_stash import ensure_json, gh_api, jq

Expand All @@ -23,7 +24,8 @@ def test_jq(self):
self.assertEqual(jq('{"a": 1}', ".a", ["-j"]).stdout, "1")

def test_jq_file(self):
self.assertEqual(jq("test.json", ".a").stdout, "1\n")
this_dir = os.path.dirname(os.path.realpath(__file__))
self.assertEqual(jq(this_dir + "/test.json", ".a").stdout, "1\n")

def test_jq_error(self):
with self.assertRaises(ValueError):
Expand Down
Loading