Skip to content

Commit

Permalink
Adds flag for github runs to force all tests to run or error out (#150)
Browse files Browse the repository at this point in the history
Previously, tests were skipped if config stuff was not properly defined,
which masked a lot of errors. This flag, set during the build process,
overrides that.

---------

Co-authored-by: Hoyt Koepke <[email protected]>
  • Loading branch information
Hoyt Koepke and Hoyt Koepke authored Jul 1, 2024
1 parent d66fc6c commit a146034
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_KEY }}
XET_FORCE_ALL_TESTS: 1
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
Expand Down
13 changes: 13 additions & 0 deletions python/pyxet/tests/cli_standalone_cp_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

if xet_cli_path is None:
print("Warning: XET_STANDALONE_CLI not set, skipping all tests.")

if os.environ.get("XET_FORCE_ALL_TESTS") == "1":
raise ValueError("xet_cli_path is not set.")

def xet_url(branch = None, path = None):
ret = f"xet://{host}:{user}/{repo}"
Expand Down Expand Up @@ -309,4 +312,14 @@ def test_directory_recursive_upload():
delete_branch(b1)


from utils import CONSTANTS, require_s3_creds

@pytest.mark.skipif(xet_cli_path is None)
@require_s3_creds()
def test_s3_sync():

b1 = utils.new_random_branch_from(f"xet://{host}:{user}/{repo}", "main")
xet_url = f"xet://{host}:{user}/{repo}/{b1}/"
run_xet("sync", f"s3://{CONSTANTS.S3_BUCKET}/sync1", xet_url)

utils.assert_remote_files_exist(f"{xet_url}/*", ["js/main.d8604548.js", "tmp-1"])
3 changes: 3 additions & 0 deletions python/pyxet/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def try_load_s3():
return False

msg = "AWS credentials not defined"
if os.environ.get("XET_FORCE_ALL_TESTS") == "1":
return pytest.mark.skipif(False, reason="") # noop

return pytest.mark.skipif(not try_load_s3(), reason=msg)


Expand Down

0 comments on commit a146034

Please sign in to comment.