davisusanibar commented on a change in pull request #131:
URL: https://github.com/apache/arrow-cookbook/pull/131#discussion_r790896500



##########
File path: java/ext/javadoctest.py
##########
@@ -0,0 +1,92 @@
+import os
+import pathlib
+import subprocess
+
+from sphinx.ext.doctest import (Any, Dict, DocTestBuilder, TestcodeDirective,
+                                TestoutputDirective, doctest, sphinx)
+from sphinx.locale import __
+
+
+class JavaDocTestBuilder(DocTestBuilder):
+    """
+    Runs java test snippets in the documentation.
+    """
+
+    name = "javadoctest"
+    epilog = __(
+        "Java testing of doctests in the sources finished, look at the "
+        "results in %(outdir)s/output.txt."
+    )
+
+    def compile(
+        self, code: str, name: str, type: str, flags: Any, dont_inherit: bool
+    ) -> Any:
+        # go to project that contains all your arrow maven dependencies
+        path_arrow_project = os.path.join(pathlib.Path.cwd(), "source", "demo")
+
+        # create list of all arrow jar dependencies
+        subprocess.check_call(
+            [
+                "mvn",
+                "-q",
+                "dependency:build-classpath",
+                "-DincludeTypes=jar",
+                "-Dmdep.outputFile=.cp.tmp",
+            ],
+            cwd=path_arrow_project,
+            text=True,
+        )
+        if not os.path.exists(path_arrow_project + "/.cp.tmp"):
+            raise RuntimeError(
+                __("invalid process to create jshell dependencies library")
+            )
+
+        # get list of all arrow jar dependencies
+        with open(os.path.join(path_arrow_project, ".cp.tmp")) as f:
+            stdout_dependency = f.read()
+        if not stdout_dependency:
+            raise RuntimeError(
+                __("invalid process to list jshell dependencies library")
+            )
+
+        # execute java testing code thru jshell and read output
+        proc_jshell_process = subprocess.Popen(
+            ["jshell", "--class-path", stdout_dependency, "-"],

Review comment:
       Please if you could help me about what part of the message:
   
   ```
   (base) ➜  arrow-cookbook git:(java-schema-cookbook) ✗ make javatest
   >>> Installing Java Dependencies <<<
   
   cd java && pip install -r requirements.txt
   Requirement already satisfied: black==21.7b0 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from -r 
requirements.txt (line 1)) (21.7b0)
   Requirement already satisfied: flake8==3.8.3 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from -r 
requirements.txt (line 2)) (3.8.3)
   Requirement already satisfied: isort==4.3.21 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from -r 
requirements.txt (line 3)) (4.3.21)
   Requirement already satisfied: click>=7.1.2 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from black==21.7b0->-r 
requirements.txt (line 1)) (7.1.2)
   Requirement already satisfied: tomli<2.0.0,>=0.2.6 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from black==21.7b0->-r 
requirements.txt (line 1)) (1.2.1)
   Requirement already satisfied: pathspec<1,>=0.8.1 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from black==21.7b0->-r 
requirements.txt (line 1)) (0.9.0)
   Requirement already satisfied: appdirs in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from black==21.7b0->-r 
requirements.txt (line 1)) (1.4.4)
   Requirement already satisfied: regex>=2020.1.8 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from black==21.7b0->-r 
requirements.txt (line 1)) (2020.6.8)
   Requirement already satisfied: mypy-extensions>=0.4.3 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from black==21.7b0->-r 
requirements.txt (line 1)) (0.4.3)
   Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from flake8==3.8.3->-r 
requirements.txt (line 2)) (0.6.1)
   Requirement already satisfied: pyflakes<2.3.0,>=2.2.0 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from flake8==3.8.3->-r 
requirements.txt (line 2)) (2.2.0)
   Requirement already satisfied: pycodestyle<2.7.0,>=2.6.0a1 in 
/Users/dsusanibar/anaconda3/lib/python3.8/site-packages (from flake8==3.8.3->-r 
requirements.txt (line 2)) (2.6.0)
   >>> Testing Java Cookbook <<<
   
   cd java && make javadoctest
   Running Sphinx v4.3.1
   loading pickled environment... done
   building [mo]: targets for 0 po files that are out of date
   building [javadoctest]: targets for 3 source files that are out of date
   updating environment: 0 added, 0 changed, 0 removed
   looking for now-outdated files... none found
   running tests...
   
   Document: schema
   ----------------
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   1 items passed all tests:
      6 tests in default
   6 tests in 1 items.
   6 passed and 0 failed.
   Test passed.
   
   Document: create
   ----------------
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   1 items passed all tests:
      4 tests in default
   4 tests in 1 items.
   4 passed and 0 failed.
   Test passed.
   
   Doctest summary
   ===============
      10 tests
       0 failures in tests
       0 failures in setup code
       0 failures in cleanup code
   build succeeded.
   
   Java testing of doctests in the sources finished, look at the results in 
build/javadoctest/output.txt.
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to