aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-01-01 14:22:50 +0100
committerEgor Tensin <Egor.Tensin@gmail.com>2023-01-01 14:57:04 +0100
commitbc4cf3160f653fd5fbc368a42128945379291208 (patch)
tree1988dfff6de688e3308abc0336d822f4affc9b86
parentworkflows/ci: upgrade an action (diff)
downloadcgitize-bc4cf3160f653fd5fbc368a42128945379291208.tar.gz
cgitize-bc4cf3160f653fd5fbc368a42128945379291208.zip
workflows/ci: use GitHub token for unit tests
For some reason, unit tests started failing during CI runs.
-rw-r--r--.github/workflows/ci.yml3
-rw-r--r--test/unit/test_bitbucket.py6
-rw-r--r--test/unit/test_github.py3
-rw-r--r--test/unit/test_gitlab.py5
4 files changed, 14 insertions, 3 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4364d5e..7f379d3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,6 +14,9 @@ jobs:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
name: 'Test / ${{ matrix.python-version }}'
+ env:
+ # API request rate limit is easily exceeded otherwise:
+ CGITIZE_GITHUB_TOKEN: '${{ secrets.CGITIZE_GITHUB_TOKEN }}'
steps:
- name: Checkout
uses: actions/checkout@v3
diff --git a/test/unit/test_bitbucket.py b/test/unit/test_bitbucket.py
index fdf55ea..2e49168 100644
--- a/test/unit/test_bitbucket.py
+++ b/test/unit/test_bitbucket.py
@@ -3,6 +3,7 @@
# For details, see https://github.com/egor-tensin/cgitize.
# Distributed under the MIT License.
+import os
import unittest
from atlassian.bitbucket.cloud import Cloud
@@ -11,7 +12,10 @@ from requests.exceptions import HTTPError
class BitbucketTests(unittest.TestCase):
def setUp(self):
- self.bitbucket = Cloud(cloud=True)
+ self.bitbucket = Cloud(
+ username=os.environ.get('CGITIZE_BITBUCKET_USERNAME'),
+ password=os.environ.get('CGITIZE_BITBUCKET_PASSWORD'),
+ cloud=True)
def test_nonexistent_repo(self):
with self.assertRaises(HTTPError):
diff --git a/test/unit/test_github.py b/test/unit/test_github.py
index be1daf6..1095c98 100644
--- a/test/unit/test_github.py
+++ b/test/unit/test_github.py
@@ -3,6 +3,7 @@
# For details, see https://github.com/egor-tensin/cgitize.
# Distributed under the MIT License.
+import os
import unittest
from github import Github, GithubException
@@ -10,7 +11,7 @@ from github import Github, GithubException
class GitHubTests(unittest.TestCase):
def setUp(self):
- self.github = Github()
+ self.github = Github(os.environ.get('CGITIZE_GITHUB_TOKEN'))
def test_nonexistent_repo(self):
with self.assertRaises(GithubException):
diff --git a/test/unit/test_gitlab.py b/test/unit/test_gitlab.py
index d37c06c..04a8f71 100644
--- a/test/unit/test_gitlab.py
+++ b/test/unit/test_gitlab.py
@@ -3,6 +3,7 @@
# For details, see https://github.com/egor-tensin/cgitize.
# Distributed under the MIT License.
+import os
import unittest
from gitlab import Gitlab
@@ -11,7 +12,9 @@ from gitlab.exceptions import GitlabGetError
class GitLabTests(unittest.TestCase):
def setUp(self):
- self.gitlab = Gitlab('https://gitlab.com')
+ self.gitlab = Gitlab(
+ 'https://gitlab.com',
+ private_token=os.environ.get('CGITIZE_GITLAB_TOKEN'))
def test_nonexistent_repo(self):
with self.assertRaises(GitlabGetError):