From 9c304727774c4635feab8a5a878fb86a93b8bc1d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 17 Oct 2018 21:16:09 +0300 Subject: [PATCH] Generate "test" directory per project --- HISTORY.rst | 3 ++- docs | 2 +- platformio/builder/tools/piomisc.py | 3 +-- platformio/commands/init.py | 23 ++++++++++++++++++++--- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index eb4a3795..dab1ede4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,7 +8,8 @@ PlatformIO 3.0 ~~~~~~~~~~~~~~~~~~ * Generate an `include `__ - directory with a README file when initializing a new project + and `test `__ + directories with a README file when initializing a new project * Support in-line comments for multi-line value (``lib_deps``, ``build_flags``, etc) in `“platformio.ini” (Project Configuration File) `__ * Improved `PIO Unified Debugger `__ for "mbed" framework and fixed issue with missed local variables diff --git a/docs b/docs index 66c067ca..3c9ceca1 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 66c067cab82f1e337e9e20b69e224c29c9c7d9b9 +Subproject commit 3c9ceca1dfc6e84088201c0fc430c0111f2b126c diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index e6628a83..ec304382 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -290,8 +290,7 @@ def ProcessDebug(env): env.Replace(PIODEBUGFLAGS=["-Og", "-g3", "-ggdb3"]) env.Append( PIODEBUGFLAGS=["-D__PLATFORMIO_DEBUG__"], - BUILD_FLAGS=env.get("PIODEBUGFLAGS", []) - ) + BUILD_FLAGS=env.get("PIODEBUGFLAGS", [])) unflags = ["-Os"] for level in [0, 1, 2]: for flag in ("O", "g", "ggdb"): diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 9d318e0c..8b8c7f80 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -78,12 +78,12 @@ def cli( click.echo("The next files/directories have been created in %s" % click.style(project_dir, fg="cyan")) - click.echo("%s - Put your header files here" % click.style( + click.echo("%s - Put project header files here" % click.style( "include", fg="cyan")) click.echo("%s - Put here project specific (private) libraries" % click.style("lib", fg="cyan")) - click.echo( - "%s - Put your source files here" % click.style("src", fg="cyan")) + click.echo("%s - Put project source files here" % click.style( + "src", fg="cyan")) click.echo("%s - Project Configuration File" % click.style( "platformio.ini", fg="cyan")) @@ -156,6 +156,7 @@ def init_base_project(project_dir): (util.get_projectsrc_dir(), None), (util.get_projectinclude_dir(), init_include_readme), (util.get_projectlib_dir(), init_lib_readme), + (util.get_projecttest_dir(), init_test_readme), ] for (path, cb) in dir_to_readme: if isdir(path): @@ -260,6 +261,22 @@ More information about PlatformIO Library Dependency Finder """) +def init_test_readme(test_dir): + with open(join(test_dir, "README"), "w") as f: + f.write(""" +This directory is intended for PIO Unit Testing and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PIO Unit Testing: +- https://docs.platformio.org/page/plus/unit-testing.html +""") + + def init_ci_conf(project_dir): with open(join(project_dir, ".travis.yml"), "w") as f: f.write("""# Continuous Integration (CI) is the practice, in software