-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from polystat/django
Django test profile
- Loading branch information
Showing
4 changed files
with
116 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Django runner | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 14 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '14' | ||
distribution: 'adopt' | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8.10' | ||
- name: Build with Maven | ||
run: mvn clean verify -B -Pdjango |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
transpiler/src/test/scala/org/polystat/py2eo/transpiler/DjangoTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.polystat.py2eo.transpiler | ||
|
||
import org.junit.FixMethodOrder | ||
import org.junit.Test | ||
import org.junit.runners.MethodSorters | ||
|
||
import java.io.File | ||
import java.nio.file.{Files, StandardCopyOption} | ||
import scala.concurrent.ExecutionContext.Implicits.global | ||
import scala.concurrent.duration.Duration | ||
import scala.concurrent.{Await, Future} | ||
import scala.reflect.io.Directory | ||
import scala.sys.process.Process | ||
|
||
@FixMethodOrder(MethodSorters.NAME_ASCENDING) | ||
class DjangoTest extends Commons { | ||
|
||
@Test def firstlyGenUnsupportedDjango(): Unit = { | ||
val root = Directory(testsPrefix) | ||
val djangoDir = Directory(root / "django") | ||
if (!djangoDir.exists) { | ||
assert(0 == Process("git clone https://github.com/django/django", root.jfile).!) | ||
} | ||
|
||
val tests = djangoDir.deepFiles.filter(_.extension == "py") | ||
val futures = for {test <- tests} yield { | ||
Future { | ||
Transpile(test.stripExtension, test.slurp) match { | ||
case None => println(s"failed to transpile ${test.name}") | ||
case Some(transpiled) => writeFile(test.jfile, "genUnsupportedEO", ".eo", transpiled) | ||
} | ||
} | ||
} | ||
|
||
for (f <- futures) Await.result(f, Duration.Inf) | ||
} | ||
|
||
@Test def secondlyCheckSyntaxForDjango() : Unit = { | ||
val django = new File("/tmp/django") | ||
val eopaths = Files.walk(django.toPath).filter(f => f.endsWith("genUnsupportedEO")) | ||
val futures = eopaths.map(path => | ||
Future { | ||
val from = new File(testsPrefix + "/django-pom.xml").toPath | ||
val to = new File(path.toString + "/pom.xml").toPath | ||
println(s"$from -> $to") | ||
Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING) | ||
assert(0 == Process( | ||
s"cp -a '$testsPrefix/../../../../../../main/eo/preface/' ${path.toString}" | ||
).! | ||
) | ||
assert(0 == Process("mvn clean test", path.toFile).!) | ||
assert(0 == Process(s"rm -rf ${path.toString}").!) | ||
// val stdout = new StringBuilder | ||
// val stderr = new StringBuilder | ||
// val exitCode = Process("mvn clean test", path.toFile) ! ProcessLogger(stdout append _, stderr append _) | ||
// if (0 != exitCode) { | ||
// println(s"for path $to stdout is \n $stdout\n stderr is \n $stderr\n") | ||
// } else { | ||
// assert(0 == Process(s"rm -rf ${path.toString}").!) | ||
// } | ||
} | ||
) | ||
futures.forEach(f => Await.result(f, Duration.Inf)) | ||
} | ||
} |
79 changes: 0 additions & 79 deletions
79
transpiler/src/test/scala/org/polystat/py2eo/transpiler/Tests.scala
This file was deleted.
Oops, something went wrong.
222b42d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:
Please, copy and paste this stack trace to GitHub: