tag:help.appveyor.com,2012-11-13:/discussions/problems/20584-unit-testing-passes-differently-locally-than-on-appveyorcomAppVeyor: Discussion 2019-02-21T06:41:04Ztag:help.appveyor.com,2012-11-13:Comment/469814992019-02-20T08:00:29Z2019-02-20T08:00:30ZUnit testing passes differently locally than on appveyor.com<div><p>Hello, I try to update UTF-unknown project on github. This is a code page detection tool. I've created a fork with a branch here: <a href="https://github.com/msdobrescu/UTF-unknown/tree/Adding_flexibility_for_sample_size">https://github.com/msdobrescu/UTF-unknown/tree/Adding_flexibility_f...</a>.<br>
There is an NUnit testsing project there. For a file that is in Greek, there are possible two encodings, one windows-1253, one is ISO-8859-7. Locally, the file is detected as ISO-8859-7, so the windows-1253 test fails. On appveyor, it is reversed, meaning it is recognized as windoes-1253, so the ISO-8859-7 test fails. I expect one of these to fail, but to fail the same locally and on appveyor.<br>
The testing is done by listing the dirs having encoding names (all are lowercase) and their files inside should have the expected encoding declared by the containing directory name. The first encoding met is considered the right one. All are tested in the same order. The first bigger probability is taken. The check is done by "<" operator.<br>
In this specific case, the Greek encoding ISO-8859-7 comes first for all cases, so it should be chosen. As note, for that file, both encoding meet the same value, but using strict operator (not "or equal" one) only one encoding should be chosen because they are also tested in the same order, always.<br>
I have taken into account the line endings too, in appveyor config.</p>
<p>My question is: why the tests are different locally than on appveyor?</p></div>msdobrescutag:help.appveyor.com,2012-11-13:Comment/469814992019-02-20T17:57:35Z2019-02-20T17:57:35ZUnit testing passes differently locally than on appveyor.com<div><p>I am not sure, but this can be related to the line ending (<code>\n</code> vs <code>\r\n</code>). Try add this at <code>init</code> stage (which happens before clone):</p>
<pre>
<code>init:
- git config --global core.autocrlf true</code>
</pre>
<p>Let us know if this helps.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/469814992019-02-20T18:00:15Z2019-02-20T18:00:15ZUnit testing passes differently locally than on appveyor.com<div><p>Hi, that's already in place. I've tried that to no change.</p></div>msdobrescutag:help.appveyor.com,2012-11-13:Comment/469814992019-02-20T22:21:31Z2019-02-20T22:21:31ZUnit testing passes differently locally than on appveyor.com<div><p>Sorry, I did not notice if you mentioned that already. I would check how it behave with some another clean VM. For example create new Windows VM on Azure or AWS, clone your repo, install .NET Core runtime and SDK and run your tests.</p>
<p>My feeling is that this can be related to the language settings on you computer, but I am not sure.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/469814992019-02-20T23:43:57Z2019-02-20T23:43:57ZUnit testing passes differently locally than on appveyor.com<div><p>We have already tried on several machines, only appveyor is anomalous so<br>
far.<br>
Actually, it does not reflect the code logic at all.</p></div>msdobrescutag:help.appveyor.com,2012-11-13:Comment/469814992019-02-21T01:07:35Z2019-02-21T01:07:35ZUnit testing passes differently locally than on appveyor.com<div><p>Well, I have added a debug string to see the order of decision for the best matching charset. From that moment it worked as expected. I have absolutely no clue why.</p></div>msdobrescutag:help.appveyor.com,2012-11-13:Comment/469814992019-02-21T02:31:08Z2019-02-21T02:31:08ZUnit testing passes differently locally than on appveyor.com<div><p>This feels like a race condition, which is being exposed on AppVeyor from time to time (because AppVeyor VMs are much less beefier than dev ones -- 2 Cores).</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/469814992019-02-21T06:41:04Z2019-02-21T06:41:04ZUnit testing passes differently locally than on appveyor.com<div><p>This was very deterministic, happened each time for a week.<br>
I'd suspect some aggressive caching or patch applied to appveyor.</p></div>msdobrescu