Skip to content

Commit

Permalink
Update tests to be based on pytest from now
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoArkadeep committed Jan 7, 2025
1 parent e7a5a59 commit 39e03a8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 47 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/publish2pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ jobs:
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt # Adjust this to your dependencies file if needed
- name: Run tests with pytest
run: |
python -m pip install pytest
pytest # Adjust this command if specific options or directories are needed
- name: Extract version from release tag
id: get_version
run: |
Expand All @@ -31,17 +41,6 @@ jobs:
sed -i "s/version=.*,/version='${{ env.version }}',/" setup.py
sed -i "s/release = .*/release = '${{ env.version }}'/" docs/source/conf.py
- name: Commit and push version updates
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add setup.py docs/source/conf.py
git commit -m "Update version to ${{ env.version }}"
git push origin HEAD:master
- name: Build release distributions
run: |
python -m pip install build
Expand Down
41 changes: 41 additions & 0 deletions tests/test_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
Copyright (c) 2024-2025 ROCK LAB PRIVATE LIMITED
This file is part of "Stresslog" project and is released under the
GNU Affero General Public License v3.0 (AGPL-3.0)
See the GNU Affero General Public License for more details: <https://www.gnu.org/licenses/agpl-3.0.html>
"""
import pytest
import stresslog as lst
import pandas as pd


def test_integration_basic():
# Test case 1: Basic well log generation and plotting
attrib = [10, 0, 0, 0, 0, 0, 0, 0]
well = lst.create_random_well(kb=35, gl=-200, step=0.15)
dev = lst.getwelldev(wella=well)
output = lst.plotPPzhang(dev, writeFile=False)

assert output is not None, "plotPPzhang did not return an output"

def test_integration_doi():
# Test case 2: Well with attributes and DOI
attrib = [10, -200, 0, 0, 0, 0, 0, 0]
well = lst.create_random_well(kb=312, gl=300, step=1)
dev = lst.getwelldev(wella=well, kickoffpoint=3000, final_angle=90, rateofbuild=0.2, azimuth=270)
output = lst.plotPPzhang(dev, attrib=attrib, doi=2625, writeFile=False)
assert output is not None, "plotPPzhang with attributes and DOI did not return an output"

def test_integration_advanced():
# Test case 3: Shallow angle well and custom TECB
attrib = [10, -200, 0, 0, 0, 0, 0, 0]
well = lst.create_random_well(kb=35, gl=-200, step=1)
dev = lst.getwelldev(wella=well, kickoffpoint=300, final_angle=10, rateofbuild=0.2, azimuth=270)
output = lst.plotPPzhang(dev, attrib=attrib, doi=2625, tecb=0.55, writeFile=False)

assert output is not None, "plotPPzhang for shallow angle well did not return an output"

print("All tests passed!")

#if __name__=="__main__":
# integrationTest()
36 changes: 0 additions & 36 deletions tests/test_ppzhang.py

This file was deleted.

0 comments on commit 39e03a8

Please sign in to comment.