(#19167) Fix skipped tests due to Tempfile.new block not being run

Tests for extlookup() key lookups were passing a block into Tempfile.new,
which it doesn't run.  The initialization of the CSV file was performed and
then extlookup() was called inside the block.  Since it isn't run, the tests
aren't executed.

This moves the tests out of the block and changes how the CSV file is created,
since the extlookup() function doesn't take an absolute path to a CSV file.
Instead a temporary directory is now created and the CSV file created inside.

An incorrect test that should have checked for a raised error has also been
fixed.