|
30 | 30 |
|
31 | 31 | from platformio import exception, fs
|
32 | 32 | from platformio.builder.tools import platformio as piotool
|
33 |
| -from platformio.compat import IS_WINDOWS, MISSING, hashlib_encode_data, string_types |
| 33 | +from platformio.compat import IS_WINDOWS, hashlib_encode_data, string_types |
34 | 34 | from platformio.http import HTTPClientError, InternetIsOffline
|
35 | 35 | from platformio.package.exception import (
|
36 | 36 | MissingPackageManifestError,
|
@@ -145,6 +145,10 @@ def __init__(self, env, path, manifest=None, verbose=False):
|
145 | 145 | self._circular_deps = []
|
146 | 146 | self._processed_search_files = []
|
147 | 147 |
|
| 148 | + # pass a macro to the projenv + libs |
| 149 | + if "test" in env.GetBuildType(): |
| 150 | + self.env.Append(CPPDEFINES=["PIO_UNIT_TESTING"]) |
| 151 | + |
148 | 152 | # reset source filter, could be overridden with extra script
|
149 | 153 | self.env["SRC_FILTER"] = ""
|
150 | 154 |
|
@@ -576,10 +580,11 @@ def lib_ldf_mode(self):
|
576 | 580 | # pylint: disable=no-member
|
577 | 581 | if not self._manifest.get("dependencies"):
|
578 | 582 | return LibBuilderBase.lib_ldf_mode.fget(self)
|
| 583 | + missing = object() |
579 | 584 | global_value = self.env.GetProjectConfig().getraw(
|
580 |
| - "env:" + self.env["PIOENV"], "lib_ldf_mode", MISSING |
| 585 | + "env:" + self.env["PIOENV"], "lib_ldf_mode", missing |
581 | 586 | )
|
582 |
| - if global_value != MISSING: |
| 587 | + if global_value != missing: |
583 | 588 | return LibBuilderBase.lib_ldf_mode.fget(self)
|
584 | 589 | # automatically enable C++ Preprocessing in runtime
|
585 | 590 | # (Arduino IDE has this behavior)
|
@@ -831,10 +836,11 @@ def extra_script(self):
|
831 | 836 |
|
832 | 837 | @property
|
833 | 838 | def lib_archive(self):
|
| 839 | + missing = object() |
834 | 840 | global_value = self.env.GetProjectConfig().getraw(
|
835 |
| - "env:" + self.env["PIOENV"], "lib_archive", MISSING |
| 841 | + "env:" + self.env["PIOENV"], "lib_archive", missing |
836 | 842 | )
|
837 |
| - if global_value != MISSING: |
| 843 | + if global_value != missing: |
838 | 844 | return self.env.GetProjectConfig().get(
|
839 | 845 | "env:" + self.env["PIOENV"], "lib_archive"
|
840 | 846 | )
|
|
0 commit comments