-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run documentation examples in pytest (!73)
Reviewed-on: https://gitea.midpathsoftware.com/midpath/jaypore_ci/pulls/73 ╔ 🔴 : JayporeCI [sha 42154f3] ┏━ build-and-test ┃ ┃ 🟢 : JciEnv [64677c34] 0:18 ┃ 🟢 : Jci [45ba1de6] 0:17 ❮-- ['JciEnv'] ┃ 🟢 : black [964bcda2] 0: 0 ❮-- ['JciEnv'] ┃ 🟢 : install-test [84da978f] 0: 0 ❮-- ['JciEnv'] ┃ 🟢 : pylint [b52c5ddc] 0:10 ❮-- ['JciEnv'] ┃ 🟢 : pytest [addae3c1] 0:27 Cov: 89% ❮-- ['JciEnv'] ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┏━ Publish ┃ ┃ 🟢 : DockerHubJci [b508360e] 1: 0 ┃ 🟢 : DockerHubJcienv [c95a4f50] 1: 3 ┃ 🟢 : PublishDocs [7c50853c] 0:45 ┃ 🔴 : PublishPypi [e2574be3] 0: 5 v0.2.29 ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
- Loading branch information
arjoonn
committed
Mar 24, 2023
1 parent
e86eaef
commit 8ee520d
Showing
12 changed files
with
121 additions
and
58 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import os | ||
from pathlib import Path | ||
import unittest | ||
|
||
import pytest | ||
|
@@ -34,6 +35,14 @@ def build(): | |
return build | ||
|
||
|
||
def set_env_keys(): | ||
os.environ["JAYPORE_GITEA_TOKEN"] = "fake_gitea_token" | ||
os.environ["JAYPORE_GITHUB_TOKEN"] = "fake_github_token" | ||
os.environ["JAYPORE_EMAIL_ADDR"] = "[email protected]" | ||
os.environ["JAYPORE_EMAIL_PASSWORD"] = "fake_email_password" | ||
os.environ["JAYPORE_EMAIL_TO"] = "[email protected]" | ||
|
||
|
||
@pytest.fixture( | ||
scope="function", | ||
params=list( | ||
|
@@ -53,11 +62,7 @@ def build(): | |
ids=idfn, | ||
) | ||
def pipeline(request): | ||
os.environ["JAYPORE_GITEA_TOKEN"] = "fake_gitea_token" | ||
os.environ["JAYPORE_GITHUB_TOKEN"] = "fake_github_token" | ||
os.environ["JAYPORE_EMAIL_ADDR"] = "[email protected]" | ||
os.environ["JAYPORE_EMAIL_PASSWORD"] = "fake_email_password" | ||
os.environ["JAYPORE_EMAIL_TO"] = "[email protected]" | ||
set_env_keys() | ||
builder = factory( | ||
repo=request.param["repo"], | ||
remote=request.param["remote"], | ||
|
@@ -73,3 +78,13 @@ def pipeline(request): | |
yield builder | ||
else: | ||
yield builder | ||
|
||
|
||
@pytest.fixture( | ||
scope="function", | ||
params=list((Path(__name__) / "../docs/source/examples").resolve().glob("*.py")), | ||
ids=str, | ||
) | ||
def doc_example_filepath(request): | ||
set_env_keys() | ||
yield request.param |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from jaypore_ci.jci import Pipeline | ||
|
||
|
||
def test_doc_examples(doc_example_filepath): | ||
with open(doc_example_filepath, "r", encoding="utf-8") as fl: | ||
code = fl.read() | ||
Pipeline.__run_on_exit__ = False | ||
exec(code) # pylint: disable=exec-used | ||
Pipeline.__run_on_exit__ = True |