[bitbake-devel,2/3] lib/layerindexlib/tests/cooker.py: Fix topdir to use an absolute (real) path

Submitted by Mark Hatle on Sept. 25, 2018, 3:07 p.m. | Patch ID: 155156

Details

Message ID 20180925150708.2983-3-mark.hatle@windriver.com
State New
Headers show

Commit Message

Mark Hatle Sept. 25, 2018, 3:07 p.m.
The test case needs to access test case files.  Different versions of python
may return absolute or relative locations in __file__.  Use the same approach
as other test cases in determining the location of the test files.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 lib/layerindexlib/tests/cooker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/lib/layerindexlib/tests/cooker.py b/lib/layerindexlib/tests/cooker.py
index 9ce6e8c..46d006b 100644
--- a/lib/layerindexlib/tests/cooker.py
+++ b/lib/layerindexlib/tests/cooker.py
@@ -32,7 +32,7 @@  class LayerIndexCookerTest(LayersTest):
         # configure the test data.  But we can emulate the basics of the layer.conf
         # files, so that is what we will do.
 
-        new_topdir = os.path.join(os.path.dirname(__file__), "testdata")
+        new_topdir = topdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "testdata")
         new_bbpath = os.path.join(new_topdir, "build")
 
         self.d.setVar('TOPDIR', new_topdir)

Comments

Mark Hatle Sept. 25, 2018, 3:18 p.m.
On 9/25/18 10:07 AM, Mark Hatle wrote:
> The test case needs to access test case files.  Different versions of python
> may return absolute or relative locations in __file__.  Use the same approach
> as other test cases in determining the location of the test files.
> 
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  lib/layerindexlib/tests/cooker.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/layerindexlib/tests/cooker.py b/lib/layerindexlib/tests/cooker.py
> index 9ce6e8c..46d006b 100644
> --- a/lib/layerindexlib/tests/cooker.py
> +++ b/lib/layerindexlib/tests/cooker.py
> @@ -32,7 +32,7 @@ class LayerIndexCookerTest(LayersTest):
>          # configure the test data.  But we can emulate the basics of the layer.conf
>          # files, so that is what we will do.
>  
> -        new_topdir = os.path.join(os.path.dirname(__file__), "testdata")
> +        new_topdir = topdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "testdata")

Ugh, copy paste failure.  I've sent a new 2/3 to correct the above line.
(Should not have the = topdir part!)

--Mark

>          new_bbpath = os.path.join(new_topdir, "build")
>  
>          self.d.setVar('TOPDIR', new_topdir)
>