Skip to content

Commit

Permalink
Fix sporadic Table_Tests failures caused by reliance on test orderi…
Browse files Browse the repository at this point in the history
…ng. (#9438)

* wip

* 4 failures

* fix

* todo
  • Loading branch information
GregoryTravis authored Mar 15, 2024
1 parent 515dacf commit bb080b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ add_specs suite_builder setup =
t2.should_fail_with Ambiguous_Column_Rename
err = t2.catch
err.column_name . should_equal "beta"
err.new_names . should_equal ["FirstColumn", "DifferentName!"]
err.new_names.sort . should_equal ["DifferentName!", "FirstColumn"]

group_builder.specify "should correctly handle edge-cases: aliased selectors" <|
t = table_builder [["alpha", [1,2,3]], ["bet", [4,5,6]]]
Expand Down Expand Up @@ -587,7 +587,7 @@ add_specs suite_builder setup =
group_builder.specify "should correctly handle problems: duplicate names" <|
map = ["Test", "Test", "Test", "Test"]
action = data.table.rename_columns map on_problems=_
tester = expect_column_names ["Test 1", "Test 2", "Test 3", "Test"]
tester = expect_column_names ["Test 1", "Test 2", "Test 3", "Test"] ignore_order=True
problems = [Duplicate_Output_Column_Names.Error ["Test", "Test", "Test"]]
Problems.test_problem_handling action problems tester

Expand Down
6 changes: 4 additions & 2 deletions test/Table_Tests/src/Common_Table_Operations/Util.enso
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import project.Common_Table_Operations.Main.Test_Setup
import project.Common_Table_Operations.Main.Test_Selection
import project.Common_Table_Operations.Aggregate_Spec

expect_column_names names table =
table.columns . map .name . should_equal names frames_to_skip=2
expect_column_names names table ignore_order=False =
case ignore_order of
False -> table.columns . map .name . should_equal names frames_to_skip=2
True -> table.columns . map .name . sort . should_equal names.sort frames_to_skip=2

type Dummy_Connection
Value
Expand Down
8 changes: 4 additions & 4 deletions test/Table_Tests/src/Database/SQLite_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ type File_Connection

add_specs suite_builder =
in_file_prefix = "[SQLite File] "
# TODO: Add a suite-level teardown to delete this file at the end.
# https://github.com/enso-org/enso/issues/9436
# https://github.com/enso-org/enso/issues/9437
database_file = Database_File.create

sqlite_spec suite_builder in_file_prefix (_ -> create_file_connection database_file.file)
Expand All @@ -410,9 +413,6 @@ add_specs suite_builder =
suite_builder.group "SQLite_Format should allow connecting to SQLite files" group_builder->
data = File_Connection.setup database_file

group_builder.teardown <|
data.teardown

group_builder.specify "should recognise a SQLite database file" <|
Auto_Detect.get_reading_format data.file . should_be_a SQLite_Format

Expand Down Expand Up @@ -442,7 +442,7 @@ add_specs suite_builder =
group_builder.specify "should connect to a db file" <|
connection = Data.read data.file
tables = connection.tables
tables.row_count . should_not_equal 0
tables.row_count . should_be_a Integer
connection.close

group_builder.specify 'should not duplicate warnings' <|
Expand Down

0 comments on commit bb080b5

Please sign in to comment.