Skip to content

Commit

Permalink
Fix static test blocks and @BeforeSuite usages to prevent excessive c…
Browse files Browse the repository at this point in the history
…ode execution when tests aren't included in a suite.
  • Loading branch information
cmnbroad committed Sep 7, 2017
1 parent f7ce97b commit 3868349
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

import org.broadinstitute.hellbender.utils.bwa.BwaMemIndex;
import org.broadinstitute.hellbender.utils.test.BaseTest;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.testng.annotations.*;

public class BwaMemIntegrationTest extends BaseTest {

private BwaMemIndex index;

@BeforeSuite
@BeforeClass
public void loadIndex() {
final String imageFile = createTempFile(b37_reference_20_21, ".img").toString();
BwaMemIndex.createIndexImageFromFastaFile(b37_reference_20_21, imageFile);
index = new BwaMemIndex(imageFile);
}

@AfterSuite
@AfterClass
public void unloadIndex() {
index.close();
index = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.broadinstitute.hellbender.utils.SparkToggleCommandLineProgram;
import org.broadinstitute.hellbender.utils.Utils;
import org.broadinstitute.hellbender.utils.param.ParamUtils;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import javax.annotation.Nonnull;
Expand Down Expand Up @@ -105,7 +105,7 @@ public class GermlineCNVCallerIntegrationTest extends CommandLineProgramTest {
private static SexGenotypeDataCollection LEARNING_SEX_GENOTYPES_DATA;
private static SexGenotypeDataCollection CALLING_SEX_GENOTYPES_DATA;

@BeforeSuite
@BeforeClass
public void init() throws IOException {
LEARNING_SEX_GENOTYPES_DATA = new SexGenotypeDataCollection(TEST_LEARNING_SAMPLE_SEX_GENOTYPES_FILE);
CALLING_SEX_GENOTYPES_DATA = new SexGenotypeDataCollection(TEST_CALLING_SAMPLE_SEX_GENOTYPES_FILE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.broadinstitute.hellbender.utils.test.BaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand All @@ -14,7 +14,7 @@ public final class GenotypeLikelihoodCalculatorsUnitTest extends BaseTest {

GenotypeLikelihoodCalculators calcs;

@BeforeSuite
@BeforeClass
public void init(){
calcs = new GenotypeLikelihoodCalculators();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.broadinstitute.hellbender.utils.Utils;
import org.broadinstitute.hellbender.utils.test.BaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -44,7 +44,7 @@ protected static List<AFCalculator> createAFCalculators(final List<AFCalculatorI
return AFCalculators;
}

@BeforeSuite
@BeforeClass
public void before() {
AA1 = makePL(Arrays.asList(A, A), 0, 20, 20);
AB1 = makePL(Arrays.asList(A, C), 20, 0, 20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import htsjdk.variant.variantcontext.*;
import org.broadinstitute.hellbender.utils.test.BaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand All @@ -18,7 +18,7 @@ public final class GeneralPloidyAFCalculationModelUnitTest extends BaseTest {
static final int numSamples = 4;
static final int samplePloidy = 4; // = 2*samplesPerPool

@BeforeSuite
@BeforeClass
public void before() {
// legacy diploid cases
AA1 = new double[]{-5.0, -20.0, -20.0};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.broadinstitute.hellbender.utils.read.GATKRead;
import org.broadinstitute.hellbender.utils.test.BaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand All @@ -31,7 +31,7 @@ public final class PairHMMLikelihoodCalculationEngineUnitTest extends BaseTest {

Allele Aref, T, C, G, Cref, ATC, ATCATC;

@BeforeSuite
@BeforeClass
public void setup() {
// alleles
Aref = Allele.create("A", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.broadinstitute.hellbender.utils.QualityUtils;
import org.broadinstitute.hellbender.utils.Utils;
import org.testng.Assert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand All @@ -16,10 +16,6 @@


public final class QualQuantizerUnitTest extends BaseTest {
@BeforeSuite
public void before() {

}

// --------------------------------------------------------------------------------
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.broadinstitute.hellbender.utils.test.BaseTest;
import org.broadinstitute.hellbender.utils.test.VariantContextTestUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand All @@ -36,7 +36,7 @@ public final class GATKVariantContextUtilsUnitTest extends BaseTest {
Allele Anoref;
Allele GT;

@BeforeSuite
@BeforeClass
public void setup() throws IOException {
// alleles
Aref = Allele.create("A", true);
Expand Down

0 comments on commit 3868349

Please sign in to comment.