Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add acceptance/selftest, showcasing basic features #2229

Merged
merged 8 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@ func TestInprocessMode(t *testing.T) {
if InprocessMode {
t.Skip("Already tested by TestAccept")
}
if runtime.GOOS == "windows" {
// - catalogs A catalog is the first layer of Unity Catalog’s three-level namespace.
// + catalogs A catalog is the first layer of Unity Catalog�s three-level namespace.
t.Skip("Fails on CI on unicode characters")
}
require.NotZero(t, testAccept(t, true, "help"))
require.NotZero(t, testAccept(t, true, "selftest"))
}

func testAccept(t *testing.T, InprocessMode bool, singleTest string) int {
Expand Down
1 change: 1 addition & 0 deletions acceptance/selftest/out.hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HELLO
30 changes: 30 additions & 0 deletions acceptance/selftest/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
=== Capturing STDERR
>>> python3 -c import sys; sys.stderr.write("STDERR\n")
STDERR

=== Capturing STDOUT
>>> python3 -c import sys; sys.stderr.write("STDOUT\n")
STDOUT

=== Capturing exit code
>>> errcode python3 -c raise SystemExit(5)

Exit code: 5

=== Capturing exit code (alt)
>>> python3 -c raise SystemExit(7)

Exit code: 7

=== Capturing pwd
>>> python3 -c import os; print(os.getcwd())
$TMPDIR

=== Capturing subdir
>>> mkdir -p subdir/a/b/c

>>> withdir subdir/a/b/c python3 -c import os; print(os.getcwd())
$TMPDIR/subdir/a/b/c

=== Custom output files - everything starting with out is captured and compared
>>> echo HELLO
21 changes: 21 additions & 0 deletions acceptance/selftest/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
printf "=== Capturing STDERR"
trace python3 -c 'import sys; sys.stderr.write("STDERR\n")'

printf "\n=== Capturing STDOUT"
trace python3 -c 'import sys; sys.stderr.write("STDOUT\n")'

printf "\n=== Capturing exit code"
trace errcode python3 -c 'raise SystemExit(5)'

printf "\n=== Capturing exit code (alt)"
errcode trace python3 -c 'raise SystemExit(7)'

printf "\n=== Capturing pwd"
trace python3 -c 'import os; print(os.getcwd())'

printf "\n=== Capturing subdir"
trace mkdir -p subdir/a/b/c
trace withdir subdir/a/b/c python3 -c 'import os; print(os.getcwd())' | sed 's/\\/\//g'

printf "\n=== Custom output files - everything starting with out is captured and compared"
trace echo HELLO > out.hello.txt
Loading