Skip to content

Commit

Permalink
fix: move runtime init to fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-tihon committed Dec 11, 2023
1 parent ec1eb19 commit d225322
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 11 deletions.
8 changes: 8 additions & 0 deletions tests/Stanford.NLP.CoreNLP.Tests/Fixtures/IkvmCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Xunit;

namespace Stanford.NLP.CoreNLP.Tests.Fixtures;

[CollectionDefinition(nameof(IkvmCollection))]
public class IkvmCollection : ICollectionFixture<IkvmFixture>
{
}
10 changes: 10 additions & 0 deletions tests/Stanford.NLP.CoreNLP.Tests/Fixtures/IkvmFixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Stanford.NLP.CoreNLP.Tests.Fixtures;

public class IkvmFixture
{
public IkvmFixture ()
{
// IKVM issue - https://github.com/ikvmnet/ikvm/issues/423
_ = new java.lang.Object();
}
}
2 changes: 2 additions & 0 deletions tests/Stanford.NLP.CoreNLP.Tests/Samples/CoreNlpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
using edu.stanford.nlp.util;
using java.io;
using java.util;
using Stanford.NLP.CoreNLP.Tests.Fixtures;
using Stanford.NLP.CoreNLP.Tests.Helpers;
using Xunit;
using Xunit.Abstractions;
using Assert = Xunit.Assert;

namespace Stanford.NLP.CoreNLP.Tests.Samples;

[Collection(nameof(IkvmCollection))]
public class CoreNlpTests
{
private readonly ITestOutputHelper _testOutputHelper;
Expand Down
6 changes: 2 additions & 4 deletions tests/Stanford.NLP.CoreNLP.Tests/Samples/CorefTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
using edu.stanford.nlp.pipeline;
using edu.stanford.nlp.util;
using java.util;
using Stanford.NLP.CoreNLP.Tests.Fixtures;
using Stanford.NLP.CoreNLP.Tests.Helpers;
using Xunit;
using Xunit.Abstractions;

namespace Stanford.NLP.CoreNLP.Tests.Samples;

[Collection(nameof(IkvmCollection))]
public class CorefTests
{
private readonly ITestOutputHelper _testOutputHelper;
Expand All @@ -25,10 +27,6 @@ public CorefTests(ITestOutputHelper testOutputHelper)
[Fact]
public void CorefTest()
{
// Black magic - https://github.com/ikvmnet/ikvm-maven/issues/46#issuecomment-1849085463
// This is the first test to run (with sequential test execution), so it affect all other tests as well
var _ = new java.lang.Object();

var document =
new Annotation("Barack Obama was born in Hawaii. He is the president. Obama was elected in 2008.");
var props = new Properties();
Expand Down
2 changes: 2 additions & 0 deletions tests/Stanford.NLP.CoreNLP.Tests/Samples/SUTimeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
using edu.stanford.nlp.time;
using edu.stanford.nlp.util;
using java.util;
using Stanford.NLP.CoreNLP.Tests.Fixtures;
using Stanford.NLP.CoreNLP.Tests.Helpers;
using Xunit;
using Xunit.Abstractions;

namespace Stanford.NLP.CoreNLP.Tests.Samples;

[Collection(nameof(IkvmCollection))]
public class SUTimeTests
{
private readonly ITestOutputHelper _testOutputHelper;
Expand Down
2 changes: 2 additions & 0 deletions tests/Stanford.NLP.CoreNLP.Tests/Samples/SimpleNlpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
using edu.stanford.nlp.ie.machinereading.structure;
using edu.stanford.nlp.simple;
using java.util;
using Stanford.NLP.CoreNLP.Tests.Fixtures;
using Stanford.NLP.CoreNLP.Tests.Helpers;
using Xunit;

namespace Stanford.NLP.CoreNLP.Tests.Samples;

[Collection(nameof(IkvmCollection))]
public class SimpleNlpTests : IDisposable
{
private readonly string _currentDir;
Expand Down
2 changes: 2 additions & 0 deletions tests/Stanford.NLP.CoreNLP.Tests/Samples/StanfordServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
using edu.stanford.nlp.util;
using java.lang;
using java.util;
using Stanford.NLP.CoreNLP.Tests.Fixtures;
using Xunit;
using Xunit.Abstractions;

namespace Stanford.NLP.CoreNLP.Tests.Samples;

[Collection(nameof(IkvmCollection))]
public class StanfordServer
{
private readonly ITestOutputHelper _testOutputHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IKVM" Version="8.7.3"/>
<PackageReference Include="IKVM.Maven.Sdk" Version="1.6.2" PrivateAssets="all"/>
<PackageReference Include="IKVM.Maven.Sdk" Version="1.6.3" PrivateAssets="all"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="xunit" Version="2.6.3"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
Expand All @@ -19,7 +19,4 @@
<ItemGroup>
<MavenReference Include="edu.stanford.nlp:stanford-corenlp" Version="4.5.5"/>
</ItemGroup>
<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>
3 changes: 0 additions & 3 deletions tests/Stanford.NLP.CoreNLP.Tests/xunit.runner.json

This file was deleted.

0 comments on commit d225322

Please sign in to comment.