forked from thomasdelrue/gh_actions_cicd_spike
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first commit with some playaround code
- Loading branch information
0 parents
commit af8301c
Showing
7 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
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,3 @@ | ||
.pytest_cache | ||
.idea | ||
__pycache__ |
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 @@ | ||
This project is just a personal playground for getting to know GH actions and how to set up a CI/CD pipeline with it for a generic Python Project |
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,4 @@ | ||
coverage | ||
pytest | ||
pytest-cov | ||
requests |
Empty file.
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,24 @@ | ||
import requests as req | ||
|
||
|
||
def func_a(arg): | ||
return arg + 1 | ||
|
||
|
||
def func_b(name: str) -> str: | ||
return name | ||
|
||
|
||
def get_uuid(): | ||
resp = req.get('http://httpbin.org/uuid') | ||
return resp.json()['uuid'] | ||
|
||
|
||
def main(): | ||
print(func_a(0)) | ||
print(func_b('narcissus')) | ||
print(get_uuid()) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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,5 @@ | ||
import os.path | ||
import sys | ||
|
||
main_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'src')) | ||
sys.path.append(main_path) |
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,23 @@ | ||
import pytest | ||
import requests | ||
|
||
from redshirt import something | ||
|
||
|
||
def test_func_a(): | ||
assert 1 == something.func_a(0) | ||
|
||
|
||
class MockResponse: | ||
@staticmethod | ||
def json(): | ||
return {'uuid': 'stub_uuid'} | ||
|
||
|
||
def test_get_uuid(monkeypatch): | ||
def mock_get(*args, **kwargs): | ||
return MockResponse() | ||
|
||
monkeypatch.setattr(requests, 'get', mock_get) | ||
|
||
assert 'stub_uuid' == something.get_uuid() |