Repository: conan-io/conan
Issue: [bug] Packages linked with static libraries cannot be used in editable mode

# Environment details
* Operating system: Rocky Linux 8.7
* Compiler: GCC 8.5.0
* Conan version: 2.0.2
* Python version: 3.9.13

# Steps to reproduce
## Create a package A in a folder

Copy the following conanfile.py

```python
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import copy, collect_libs

class Pkg(ConanFile):
	required_conan_version = ">=1.50.0"
	name = "A"
	version = "1.0"

	# Binary configuration
	settings = "os", "compiler", "build_type", "arch"
	options = {
		"shared": [True, False],
		"fPIC": [True, False],
	}
	default_options = {
		"shared": False,
		"fPIC": True,
	}

	def export_sources(self):
		copy(self, "*.c*", src=self.recipe_folder, dst=self.export_sources_folder)
		copy(self, "*CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder)

	def build_requirements(self):
		self.test_requires("gtest/1.13.0")

	def config_options(self):
		if self.settings.os == "Windows":
			del self.options.fPIC

	def layout(self):
		cmake_layout(self)

	def generate(self):
		vr = VirtualRunEnv(self)
		vr.generate()
		ct = CMakeToolchain(self)
		ct.generate()
		cd = CMakeDeps(self)
		cd.generate()

	def build(self):
		cmake = CMake(self)
		cmake.configure()
		cmake.build()
```

Copy the following CMakeLists.txt


```cmake
cmake_minimum_required(VERSION 3.23)

set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_STANDARD 17)
set(PROJECT_NAME test)

project(${PROJECT_NAME} LANGUAGES CXX)

find_package(GTest)

add_library(${PROJECT_NAME})

target_sources(${PROJECT_NAME}
	PRIVATE
		a.cpp
)

target_link_libraries(${PROJECT_NAME}
	PRIVATE
		gtest::gtest
)
```

Copy the following source file *a.cpp*
```cpp
#include <gtest/gtest.h>

std::string	hello()
{
	return "Hello";
}

TEST(testMath, test_hello)
{
    EXPECT_EQ("Hello", hello());
}
```

Run the following command :
```shell
conan build . -verror --settings "&:build_type=Debug" --options="A/*:shared=True" --build=missing
```

A *libtest.so* is successfully created in build/Debug. It is linked with a static version of gtest.

Mark the reciped as editable with
```shell
conan editable add .
```

The command returns
```shell
Reference 'A/1.0' in editable mode
```

## Create a package B in another folder

Copy the following conanfile.py

```python
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import copy, collect_libs

class Pkg(ConanFile):
	required_conan_version = ">=1.50.0"
	name = "B"
	version = "1.0"

	# Binary configuration
	settings = "os", "compiler", "build_type", "arch"
	options = {
		"shared": [True, False],
		"fPIC": [True, False],
	}
	default_options = {
		"shared": False,
		"fPIC": True,
	}

	def export_sources(self):
		copy(self, "*.c*", src=self.recipe_folder, dst=self.export_sources_folder)
		copy(self, "*CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder)

	def requirements(self):
		self.requires("A/1.0")
	def config_options(self):
		if self.settings.os == "Windows":
			del self.options.fPIC

	def layout(self):
		cmake_layout(self)

	def generate(self):
		vr = VirtualRunEnv(self)
		vr.generate()
		ct = CMakeToolchain(self)
		ct.generate()
		cd = CMakeDeps(self)
		cd.generate()

	def build(self):
		cmake = CMake(self)
		cmake.configure()
		cmake.build()
```

Copy the following CMakeLists.txt


```cmake
cmake_minimum_required(VERSION 3.23)

set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_STANDARD 17)
set(PROJECT_NAME test)

project(${PROJECT_NAME} LANGUAGES CXX)

add_executable(${PROJECT_NAME})

target_sources(${PROJECT_NAME}
	PRIVATE
		b.cpp
)
```

Copy the following source file *b.cpp*
```cpp
int	main()
{
	return 0;
}
```

Run the command
```shell
conan build . -verror --settings "&:build_type=Debug" --build=missing
```

The following error shows up:
```shell
ERROR: A/1.0: Error in generate() method, line 49
        cd.generate()
        ConanException: error generating context for 'gtest/1.13.0': include is not absolute
```

**Expected results** : Package B should compile without any issue.

From my understanding, this happens whenever a shared library links with a static one. Compiling gtest as a shared library fixes the issue. However, gtest is usually compiled as a static library.

The issue also happens:
- While using Boost as a dependency and compiled as a shared library. I get the same error with libbacktrace, even though it is not a direct dependency of my project (but used by Boost).
- With any non direct dependency that I didn't specify to be built as shared ones.

**Might be another bug** : self.options does not affect packages added with test_requirements. (e.g: gtest)


Changed files:
conans/test/integration/editable/transitive_editable_test.py, conans/client/graph/graph_binaries.py

diff --git a/conans/client/graph/graph_binaries.py b/conans/client/graph/graph_binaries.py
index 99b2227c2..4284d288d 100644
--- a/conans/client/graph/graph_binaries.py
+++ b/conans/client/graph/graph_binaries.py
@@ -336,7 +336,8 @@ class GraphBinariesAnalyzer(object):
         required_nodes = set()
         required_nodes.add(graph.root)
         for node in graph.nodes:
-            if node.binary != BINARY_BUILD and node is not graph.root:
+            if node.binary not in (BINARY_BUILD, BINARY_EDITABLE_BUILD, BINARY_EDITABLE) \\
+                    and node is not graph.root:
                 continue
             for req, dep in node.transitive_deps.items():
                 dep_node = dep.node
diff --git a/conans/test/integration/editable/transitive_editable_test.py b/conans/test/integration/editable/transitive_editable_test.py
index 74f9a458d..9a2836406 100644
--- a/conans/test/integration/editable/transitive_editable_test.py
+++ b/conans/test/integration/editable/transitive_editable_test.py
@@ -1,40 +1,76 @@
-# coding=utf-8
+import textwrap
 
-import os
-import unittest
+from conans.test.utils.tools import TestClient, GenConanfile
 
-import pytest
 
-from conans.model.recipe_ref import RecipeReference
-from conans.test.utils.tools import TestClient, GenConanfile
-from conans.util.files import mkdir
+def test_transitive_editables_half_diamond():
+    # https://github.com/conan-io/conan/issues/4445
+    client = TestClient()
+    client.save({"libc/conanfile.py": GenConanfile("libc", "0.1"),
+                 "libb/conanfile.py": GenConanfile("libb", "0.1").with_require("libc/0.1"),
+                 "liba/conanfile.py": GenConanfile("liba", "0.1").with_requires("libb/0.1",
+                                                                                "libc/0.1")})
+    client.run("editable add libc")
+    client.run("create libb")
+    client.run("install liba")
+    assert "libc/0.1 - Editable" in client.out
+    with client.chdir("liba/build"):
+        client.run("install ..")
+        assert "libc/0.1 - Editable" in client.out
+
+
+def test_transitive_editable_test_requires():
+    """
+    This test was crashing because editable packages was "SKIP"ing some dependencies as
+    "test_requires", but editables need the dependencies to generate() and to build()
+
+    https://github.com/conan-io/conan/issues/13543
+    """
+    c = TestClient()
+    pkga = textwrap.dedent("""
+        from conan import ConanFile
+        from conan.tools.cmake import CMakeDeps, cmake_layout
+
+        class Pkg(ConanFile):
+            name = "pkga"
+            version = "1.0"
+
+            # Binary configuration
+            settings = "os", "compiler", "build_type", "arch"
 
+            def build_requirements(self):
+                self.test_requires("gtest/1.0")
 
-class TransitiveEditableTest(unittest.TestCase):
+            def layout(self):
+                cmake_layout(self)
 
-    @pytest.mark.xfail(reason="Editables not taken into account for cache2.0 yet."
-                              "TODO: cache2.0 fix with editables")
-    def test_transitive_editables(self):
-        # https://github.com/conan-io/conan/issues/4445
-        libc_ref = RecipeReference.loads("LibC/0.1@user/testing")
-        libb_ref = RecipeReference.loads("LibB/0.1@user/testing")
+            def generate(self):
+                cd = CMakeDeps(self)
+                cd.generate()
+        """)
+    pkgb = textwrap.dedent("""
+        from conan import ConanFile
+        from conan.tools.cmake import cmake_layout
 
-        client = TestClient()
-        conanfileC = GenConanfile()
-        client.save({"conanfile.py": str(conanfileC)})
-        client.run("editable add . LibC/0.1@user/testing")
+        class Pkg(ConanFile):
+            name = "pkgb"
+            version = "1.0"
 
-        client2 = TestClient(client.cache_folder)
-        conanfileB = GenConanfile().with_name("LibB").with_version("0.1").with_require(libc_ref)
+            # Binary configuration
+            settings = "os", "compiler", "build_type", "arch"
 
-        client2.save({"conanfile.py": str(conanfileB)})
-        client2.run("create . --user=user --channel=testing")
+            def requirements(self):
+                self.requires("pkga/1.0")
 
-        conanfileA = GenConanfile().with_name("LibA").with_version("0.1")\\
-                                   .with_require(libb_ref)\\
-                                   .with_require(libc_ref)
-        client2.save({"conanfile.py": str(conanfileA)})
-        client2.run("install .")
-        client2.current_folder = os.path.join(client2.current_folder, "build")
-        mkdir(client2.current_folder)
-        client2.run("install ..")
+            def layout(self):
+                cmake_layout(self)
+            """)
+    c.save({"gtest/conanfile.py": GenConanfile("gtest", "1.0"),
+            "pkga/conanfile.py": pkga,
+            "pkgb/conanfile.py": pkgb})
+    c.run("create gtest")
+    c.run("build pkga")
+    c.run("editable add pkga")
+    # This used to crash, due to paths in test_requires not being processed (package_info() not
+    # being called
+    c.run("build pkgb")