Skip to content

Commit

Permalink
#47 Restored testing for all plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Aug 20, 2024
1 parent b68fa23 commit f4ce51a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROJECTS := "pytest-backend"
PROJECTS := "pytest-slc pytest-backend pytest-saas pytest-itde"

# Default target
default:
Expand Down
46 changes: 21 additions & 25 deletions pytest-backend/test/integration/pytest_backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,27 @@

pytest_plugins = ["pytester"]

_test_code = dedent("""
import pyexasol
import exasol.bucketfs as bfs
@pytest.mark.parametrize(
"test_code",
[
dedent("""
import pyexasol
def test_backend_aware_database_params(backend_aware_database_params):
conn = pyexasol.connect(**backend_aware_database_params)
res = conn.execute('SELECT SESSION_ID FROM SYS.EXA_ALL_SESSIONS;').fetchall()
assert res
"""),
dedent("""
import exasol.bucketfs as bfs
def test_backend_aware_bucketfs_params(backend_aware_bucketfs_params):
bfs_path = bfs.path.build_path(**backend_aware_bucketfs_params, path='plugin_test')
file_content = b'In God We Trust'
bfs_path.write(file_content)
data_back = b''.join(bfs_path.read())
bfs_path.rm()
assert data_back == file_content
"""),
], ids=["database", "bucketfs"]
)
def test_pytest_backend(pytester, test_code):
pytester.makepyfile(test_code)
def test_backend_aware_database_params(backend_aware_database_params):
conn = pyexasol.connect(**backend_aware_database_params)
res = conn.execute('SELECT SESSION_ID FROM SYS.EXA_ALL_SESSIONS;').fetchall()
assert res
def test_backend_aware_bucketfs_params(backend_aware_bucketfs_params):
bfs_path = bfs.path.build_path(**backend_aware_bucketfs_params, path='plugin_test')
file_content = b'In God We Trust'
bfs_path.write(file_content)
data_back = b''.join(bfs_path.read())
bfs_path.rm()
assert data_back == file_content
""")


def test_pytest_backend(pytester):
pytester.makepyfile(_test_code)
result = pytester.runpytest(BACKEND_OPTION, BACKEND_ONPREM, BACKEND_OPTION, BACKEND_SAAS)
assert result.ret == pytest.ExitCode.OK
result.assert_outcomes(passed=2, skipped=0)
result.assert_outcomes(passed=4, skipped=0)

0 comments on commit f4ce51a

Please sign in to comment.