HtseqCountTest.scala 1.71 KB
Newer Older
bow's avatar
bow committed
1
/**
bow's avatar
bow committed
2
3
4
5
6
7
8
9
10
11
12
13
14
 * Biopet is built on top of GATK Queue for building bioinformatic
 * pipelines. It is mainly intended to support LUMC SHARK cluster which is running
 * SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
 * should also be able to execute Biopet tools and pipelines.
 *
 * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
 *
 * Contact us at: sasc@lumc.nl
 *
 * A dual licensing mode is applied. The source code within this project that are
 * not part of GATK Queue is freely available for non-commercial use under an AGPL
 * license; For commercial users or users who do not want to follow the AGPL
 * license, please contact us to obtain a separate license.
bow's avatar
bow committed
15
16
17
 */
package nl.lumc.sasc.biopet.extensions

bow's avatar
bow committed
18
19
20
21
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.SkipException
import org.testng.annotations.{ BeforeClass, Test }
bow's avatar
bow committed
22

Peter van 't Hof's avatar
Peter van 't Hof committed
23
24
import scala.sys.process.{ Process, ProcessLogger }

bow's avatar
bow committed
25
26
27
class HtseqCountTest extends TestNGSuite with Matchers {

  @BeforeClass def checkExecutable() = {
bow's avatar
bow committed
28
29
    val wrapper = new HtseqCount(null)
    val proc = Process(wrapper.versionCommand)
bow's avatar
bow committed
30
31
32
33
34
35
36
37
    val exitCode =
      try {
        proc.run(ProcessLogger(lines => (), lines => ())).exitValue()
      } catch {
        case e: java.io.IOException => -1
        // rethrow if it's not IOException (we only expect IOException if the executable is missing)
        case e: Exception           => throw e
      }
bow's avatar
bow committed
38
39
40
41
    if (exitCode != 0)
      throw new SkipException("Skipping htseq-count test because the executable can not be found")
  }

bow's avatar
bow committed
42
43
  @Test(description = "htseq-count version number capture from executable")
  def testVersion() = new HtseqCount(null).getVersion should not be "N/A"
bow's avatar
bow committed
44
}