Skip to content

Commit 1fb9ac4

Browse files
committed
fix problematic unit test on windows due to line ending conversion
1 parent 2a9d1a7 commit 1fb9ac4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

dotnet/Razorvine.Pyrolite/Pyrolite/Pyrolite.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
Also includes Pickle/Unpickle.
1717
More info about Pyro: https://pyro4.readthedocs.io/</Description>
1818
<Copyright>Copyright Irmen de Jong</Copyright>
19+
<!--
20+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
21+
<PackageLicenseFile>../LICENSE</PackageLicenseFile>
22+
-->
1923
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
2024
<PackageProjectUrl>https://github.com/irmen/Pyrolite</PackageProjectUrl>
2125
<RepositoryUrl>https://github.com/irmen/Pyrolite.git</RepositoryUrl>

dotnet/Razorvine.Pyrolite/Tests/Pickle/UnpickleComplexTests.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ public void TestUnpickleRealProxy4() {
8989
UnpickleRealProxy(pickledProxy);
9090
}
9191

92-
[Fact] // fails on Windows due to "\r\n" line ending
92+
[Fact]
9393
public void TestUnpickleProto0Bytes() {
94-
var pickle = File.ReadAllBytes("pickled_bytes_level0.dat");
94+
// note: convert \r\n that may be inserted in the data file on windows, back to \n that pickle expects
95+
var pickle = File.ReadAllText("pickled_bytes_level0.dat").Replace("\r\n", "\n");
9596

9697
PickleSerializer ser = new PickleSerializer();
97-
string x = (string)ser.deserializeData(pickle);
98+
string x = (string)ser.deserializeData(Encoding.UTF8.GetBytes(pickle));
9899
Assert.Equal(2496, x.Length);
99100

100101
// validate that the bytes in the string are what we expect (based on md5 hash)

0 commit comments

Comments
 (0)