mik icon indicating copy to clipboard operation
mik copied to clipboard

Some tests are failing on Windows

Open mjordan opened this issue 7 years ago • 2 comments

On Windows, running ./vendor/bin/phpunit --exclude-group inputvalidators --bootstrap vendor/autoload.php tests on Windows results in six test failures ("Tests: 42, Assertions: 52, Errors: 2, Failures: 6."):

  • mik\writers\CsvSingleFileToolchainTest::testCreateMetadata
  • mik\writers\CsvSingleFileToolchainTest::testWritePackages
  • mik\metadataparsers\mods\MetadataManipulatorTest::testInsertXMLFromTemplateManipulator
  • mik\metadataparsers\mods\MetadataManipulatorTest::testSplitRepeatedValuesMetadataManipulator
  • mik\writers\CsvCompoundToolchainTest::testWritePackages
  • mik\writers\CsvNewspaperToolchainTest::testCreateMetadata

Running ./vendor/bin/phpunit --group inputvalidators --bootstrap vendor/autoload.php tests results in 2 failures ("Tests: 4, Assertions: 10, Failures: 2."):

  • mik\inputvalidators\CsvInputValidatorsTest::testCsvCompoundInputValidator
  • mik\inputvalidators\CsvInputValidatorsTest::testCsvBooksInputValidator

These failures happen on newly cloned instances of MIK, but only on Windows. I have cloned the repo to two separate locations on a machine where tests once passed. I cannot replicate the failures on Linux.

I will test on a second Windows machine this evening to see if tests fail there. If they do, it's a Windows issue, if they don't, it's my Windows VM.

mjordan avatar Mar 06 '17 23:03 mjordan

Same tests fail on a completely different Windows machine, using a clean clone of the mik repo.

mjordan avatar Mar 07 '17 01:03 mjordan

Just for kicks I ran the PHPUnit tests on Windows just now (running 0d64935d9d51df4220a60fc6fd8a5552b24758fb) and got the following failures. These same tests pass on Linux and OSX. I ran these tests using PHPUnit 4.8.35 on Windows 7 Enterprise running Git Bash, using the command vendor/bin/phpunit --exclude-group inputvalidators --bootstrap vendor/autoload.php tests.

All of the failures are of PHPUnit's assertContains():

There were 8 failures:

1) mik\writers\CsvSingleFileToolchainTest::testCreateMetadata
CSV to MODS metadata parser did not work
Failed asserting that '<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
  <titleInfo>
    <title>Mount Arrowsmith and Port Alberni Highway, Vancouver Island, B.C.</title>
  </titleInfo>
  <originInfo>
    <dateIssued encoding="w3cdtf">1954</dateIssued>
  </originInfo>
  <abstract>View of Mount Arrowsmith on Vancouver Island, B.C. The Port Alberni Highway is shown in the foreground with two automobiles driving on it.</abstract>
  <identifier type="uuid"/>
  <extension>
    <CSVData/>
  </extension>
  <subject>
    <geographic>Arrowsmith, Mount, BC</geographic>
  </subject>
  <subject authority="lcsh">
    <topic>Views; Mountains; Roads; Automobiles</topic>
  </subject>
</mods>
' contains "  <originInfo>
    <dateIssued encoding="w3cdtf">1954</dateIssued>
  </originInfo>".

M:\mik_mark\tests\CsvSingleFileToolchainTest.php:104

2) mik\writers\CsvSingleFileToolchainTest::testWritePackages
CSV to MODS metadata parser did not work
Failed asserting that '<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
  <titleInfo>
    <title>Mount Arrowsmith and Port Alberni Highway, Vancouver Island, B.C.</title>
  </titleInfo>
  <originInfo>
    <dateIssued encoding="w3cdtf">1954</dateIssued>
  </originInfo>
  <abstract>View of Mount Arrowsmith on Vancouver Island, B.C. The Port Alberni Highway is shown in the foreground with two automobiles driving on it.</abstract>
  <identifier type="uuid"/>
  <extension>
    <CSVData/>
  </extension>
  <subject>
    <geographic>Arrowsmith, Mount, BC</geographic>
  </subject>
  <subject authority="lcsh">
    <topic>Views; Mountains; Roads; Automobiles</topic>
  </subject>
</mods>
' contains "  <originInfo>
    <dateIssued encoding="w3cdtf">1954</dateIssued>
  </originInfo>".

M:\mik_mark\tests\CsvSingleFileToolchainTest.php:144

3) mik\metadataparsers\mods\MetadataManipulatorTest::testInsertXMLFromTemplateManipulator
InsertXMLFromTemplate metadata manipulator failed
Failed asserting that '<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
  <titleInfo>
    <title>Hampshire College Commencement Poster - May 2011</title>
  </titleInfo>
  <originInfo>
    <dateIssued>2011-05-01</dateIssued>
  </originInfo>
  <name authority="local" type="personal">
    <role>
      <roleTerm authority="marcRelator" type="text">Artist</roleTerm>
    </role>
    <namePart>Ortiz-Palacios, Guillermo</namePart>
  </name>
</mods>
' contains "  <name authority="local" type="personal">
    <role>
      <roleTerm authority="marcRelator" type="text">Artist</roleTerm>
    </role>
    <namePart>Ortiz-Palacios, Guillermo</namePart>
  </name>".

M:\mik_mark\tests\MetadataManipulatorTest.php:206

4) mik\metadataparsers\mods\MetadataManipulatorTest::testSplitRepeatedValuesMetadataManipulator
SplitRepeatedValues metadata manipulator did not work
Failed asserting that '<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
  <titleInfo>
    <title>Westminster Ave. looking South, Vancouver, B.C.</title>
  </titleInfo>
  <originInfo>
    <dateIssued encoding="w3cdtf">1909</dateIssued>
  </originInfo>
  <subject>
    <geographic>Vancouver, BC</geographic>
  </subject>
  <subject authority="lcsh">
    <topic>Streets</topic>
  </subject>
  <subject authority="lcsh">
    <topic>Storefronts</topic>
  </subject>
  <subject authority="lcsh">
    <topic>Pedestrians</topic>
  </subject>
  <abstract>Westminster Avenue in Vancouver, B.C. looking south. Some storefronts and pedestrians are shown.</abstract>
  <identifier type="uuid"/>
  <extension>
    <CSVData/>
  </extension>
</mods>
' contains "  <subject>
    <geographic>Vancouver, BC</geographic>
  </subject>".

M:\mik_mark\tests\MetadataManipulatorTest.php:245

5) mik\writers\TemplatedMetadataParserTest::testCreateMetadata
Templated metadata parser did not work
Failed asserting that '<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
  <titleInfo>
     <title>Mount Arrowsmith and Port Alberni Highway, Vancouver Island, B.C.</title>
  </titleInfo>
  <originInfo>
    <dateIssued encoding="w3cdtf">1954</dateIssued>
  </originInfo>
</mods>' contains "  <originInfo>
    <dateIssued encoding="w3cdtf">1954</dateIssued>
  </originInfo>".

M:\mik_mark\tests\TemplatedMetadataParserTest.php:105

6) mik\writers\TemplatedMetadataParserTest::testWritePackages
Templated metadata parser did not work
Failed asserting that '<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
  <titleInfo>
     <title>Mount Arrowsmith and Port Alberni Highway, Vancouver Island, B.C.</title>
  </titleInfo>
  <originInfo>
    <dateIssued encoding="w3cdtf">1954</dateIssued>
  </originInfo>
</mods>' contains "  <originInfo>
    <dateIssued encoding="w3cdtf">1954</dateIssued>
  </originInfo>".

M:\mik_mark\tests\TemplatedMetadataParserTest.php:147

7) mik\writers\CsvCompoundToolchainTest::testWritePackages
CSV to MODS metadata parser did not work
Failed asserting that '<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
  <titleInfo>
    <title>Second compound object, part 4</title>
  </titleInfo>
</mods>
' contains "  <titleInfo>
    <title>Second compound object, part 4</title>
  </titleInfo>".

M:\mik_mark\tests\XCsvCompoundToolchainTest.php:199

8) mik\writers\CsvNewspaperToolchainTest::testCreateMetadata
CSV to MODS metadata parser did not work
Failed asserting that '<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
  <titleInfo>
    <title>Testing Times, December 14, 1918</title>
  </titleInfo>
  <originInfo>
    <dateIssued encoding="w3cdtf" keyDate="yes">1918-12-14</dateIssued>
  </originInfo>
  <identifier type="local">TT0002</identifier>
  <accessCondition type="use and reproduction">Public domain</accessCondition>
  <genre authority="lcgft">newspapers</genre>
  <typeOfResource>text</typeOfResource>
</mods>
' contains "  <originInfo>
    <dateIssued encoding="w3cdtf" keyDate="yes">1918-12-14</dateIssued>
  </originInfo>".

M:\mik_mark\tests\XCsvNewspaperToolchainTest.php:117

FAILURES!
Tests: 46, Assertions: 57, Errors: 2, Failures: 8.

Googling for any references to assertContains failing on Windows but not on other platforms brings up nothing. If assertContains uses regexes to do its matching, I'm guessing these failures are caused by line endings or space handling in git across operating systems. Not being able to find any reference to similar incidents makes me feel very google lonely.

mjordan avatar May 30 '17 18:05 mjordan