title: How to test an installed package with testthat?
body: <p>I would like to test an installed package, but this returns an error.</p>
  
  <pre><code>library(testthat)
  test_package("testthat")
  # Error: No tests found for testthat
  </code></pre>
  
  <p>test_package (<a href="https://github.com/hadley/testthat/blob/c201c3628a2727d7dd9e9cf5c35ac68caa14457e/R/test-package.r" rel="noreferrer">source here</a>) returns this error because <code>system.file("tests", package = package)</code> is empty. In fact, the <code>tests</code> directory is missing from the package installed.</p>
  
  <pre><code>list.dirs(system.file("", package = "testthat"))
  # [1] "/home/paul/R/x86_64-pc-linux-gnu-library/3.2/testthat/"     
  # [2] "/home/paul/R/x86_64-pc-linux-gnu-library/3.2/testthat//help"
  # [3] "/home/paul/R/x86_64-pc-linux-gnu-library/3.2/testthat//html"
  # [4] "/home/paul/R/x86_64-pc-linux-gnu-library/3.2/testthat//libs"
  # [5] "/home/paul/R/x86_64-pc-linux-gnu-library/3.2/testthat//Meta"
  # [6] "/home/paul/R/x86_64-pc-linux-gnu-library/3.2/testthat//R"  
  </code></pre>
  
  <p>How to install a package so that its tests directory remains present?</p>