[SCM] ci-tooling packaging branch, master, updated. 707cc02385c89f3881361b65ba2b07c7cb5970b9

Harald Sitter apachelogger-guest at moszumanska.debian.org
Tue Nov 10 15:18:11 UTC 2015


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

The following commit has been merged in the master branch:
commit 707cc02385c89f3881361b65ba2b07c7cb5970b9
Author: Harald Sitter <sitter at kde.org>
Date:   Tue Nov 10 16:18:01 2015 +0100

    let kcibuilder run on fake kci data
---
 lib/xci.rb                             | 18 +++++++++++++++++-
 {data => test/data/fake_data}/kci.yaml |  2 +-
 test/test_kci_builder.rb               |  3 +++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/lib/xci.rb b/lib/xci.rb
index 9568e66..79398f1 100644
--- a/lib/xci.rb
+++ b/lib/xci.rb
@@ -67,10 +67,26 @@ module XCI
     @data_file_name ||= "#{to_s.downcase}.yaml"
   end
 
+  def data_dir
+    @data_dir ||= File.join(File.dirname(__dir__), 'data')
+  end
+
+  def data_dir=(data_dir)
+    reset!
+    @data_dir = data_dir
+  end
+
   def data
     return @data if defined?(@data)
-    file = File.join(File.dirname(__dir__), 'data', data_file_name)
+    file = File.join(data_dir, data_file_name)
+    p file
     fail "Data file not found (#{file})" unless File.exist?(file)
     @data = YAML.load(File.read(file))
   end
+
+  def reset!
+    instance_variables.each do |v|
+      remove_instance_variable(v)
+    end
+  end
 end
diff --git a/data/kci.yaml b/test/data/fake_data/kci.yaml
similarity index 86%
copy from data/kci.yaml
copy to test/data/fake_data/kci.yaml
index 8074784..8a8940d 100644
--- a/data/kci.yaml
+++ b/test/data/fake_data/kci.yaml
@@ -1,6 +1,6 @@
 series:
-  xenial: "16.04"
   wily: "15.10"
+  vivid: "15.04"
 architectures:
   - amd64
   - i386
diff --git a/test/test_kci_builder.rb b/test/test_kci_builder.rb
index 3dd0396..1deee05 100644
--- a/test/test_kci_builder.rb
+++ b/test/test_kci_builder.rb
@@ -24,12 +24,15 @@ class KCIBuilderTest < TestCase
       OS.instance_variable_set(:@hash, VERSION_ID: '15.04', ID: 'ubuntu')
     end
     alias_time
+
+    KCI.send(:data_dir=, File.join(File.dirname(@datadir), 'fake_data'))
   end
 
   def teardown
     unalias_time
     OS.reset
     KCIBuilder.testing = false
+    KCI.send(:reset!)
   end
 
   def alias_time

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list