[SCM] ci-tooling packaging branch, master, updated. 32fac332e6fb80bd1362dbcad45b0be8445bd5c6

Harald Sitter apachelogger-guest at moszumanska.debian.org
Mon Mar 16 11:11:27 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=e57e274

The following commit has been merged in the master branch:
commit e57e274ac5771cbdbd4fe47569da26a1a509438c
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Mar 16 11:46:37 2015 +0100

    restructure test_project fixture loading to be more dynamic
---
 test/data/{projects => test_projects}/projects.json     |  0
 .../{projects => test_projects/quilt}/debian/control    |  0
 test/data/test_projects/test_init                       |  1 +
 test/test_projects.rb                                   | 17 ++++++++++++++---
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/test/data/projects/projects.json b/test/data/test_projects/projects.json
similarity index 100%
rename from test/data/projects/projects.json
rename to test/data/test_projects/projects.json
diff --git a/test/data/projects/debian/control b/test/data/test_projects/quilt/debian/control
similarity index 100%
rename from test/data/projects/debian/control
rename to test/data/test_projects/quilt/debian/control
diff --git a/test/data/test_projects/test_init b/test/data/test_projects/test_init
new file mode 120000
index 0000000..1147965
--- /dev/null
+++ b/test/data/test_projects/test_init
@@ -0,0 +1 @@
+quilt
\ No newline at end of file
diff --git a/test/test_projects.rb b/test/test_projects.rb
index f3b8c0f..966fdaa 100644
--- a/test/test_projects.rb
+++ b/test/test_projects.rb
@@ -17,8 +17,19 @@ end
 
 class ProjectTest < Test::Unit::TestCase
   def setup
-    @testdir = File.expand_path(File.dirname(__FILE__))
-    @datadir = "#{@testdir}/data/projects"
+    script_base_path = File.expand_path(File.dirname(__FILE__))
+    script_name = File.basename(__FILE__, '.rb')
+    @datadir = File.join(script_base_path, 'data', script_name)
+  end
+
+  def data(subpath = nil)
+    index = 0
+    caller = ''
+    until caller.start_with?('test_')
+      caller = caller_locations(index, 1)[0].label
+      index += 1
+    end
+    File.join(*[@datadir, caller, subpath].compact!)
   end
 
   def create_fake_git(name:, component:, branches:)
@@ -33,7 +44,7 @@ class ProjectTest < Test::Unit::TestCase
 
       `git clone #{remotetmpdir}/tc/tn clone`
       Dir.chdir('clone') do
-        FileUtils.cp_r("#{@datadir}/debian", '.')
+        FileUtils.cp_r("#{data}/debian", '.')
         `git add *`
         `git commit -m 'commitmsg'`
         branches.each { |branch| `git branch #{branch}` }

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list