Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The IDE says that it can't run tests Introduction / Getting started / Hello World #265

Open
edutools-service opened this issue Jun 9, 2023 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@edutools-service
Copy link

The IDE cant run test, you cannot complete the question on Idea Commnunity, (I test this in 2 diferent linux distributions) and not found any solution on internet
No tests have run. For more information, see the Troubleshooting guide

@edutools-service edutools-service added the bug Something isn't working label Jun 9, 2023
@airvzxf
Copy link

airvzxf commented Jun 12, 2023

It is happening to me, if you look in the directory the test should be blank:

cd ~/Downloads/rust/Learn Rust/Introduction/Getting started/Hello World

❯ ls -lha tests/tests.rs
.rw-r--r-- wolf users 0 B Sun Jun 11 09:59:09 2023  tests/tests.rs

❯ ls -lha src/main.rs
.rw-r--r-- wolf users 45 B Sat Jun 10 02:56:15 2023  src/main.rs

But in this repository, the test file has some code. I wonder why it is empty. Let me try to do some tests to check if I find a solution.

You can get the path with these steps:

Screenshot_2023-06-11_22-44-48

Screenshot_2023-06-11_22-45-12

@airvzxf
Copy link

airvzxf commented Jun 12, 2023

I found the possible problem, but it needs confirmation from JetBrains Academy.

If you go to the plugin page, Learn Rust in the version section. Then download the file version 17. And extract the Zip file, it will show a JSON file (course.json) with the structure and information of the course. Analyzing it, for example in the “Hello World” section it is missing the test file, for that reason, it should be created in the folder test with an empty file test.rs, every time you run the check button in your course.

But, in this repository exists the test file with the code Introduction/Getting started/Hello World/tests/tests.rs.

Possible solution: I will download this repository, then copy and paste all the folders (Introduction, Common Collections, etcetera) into my directory created by JetBrains academy, in my case is ~/Downloads/rust/Learn Rust. Or maybe, my first test is to copy all the content in the repository folder into ~/Downloads/rust/Learn Rust.


       │ File: course.json
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ {
   2   │   "course_version" : 17,
   3   │   "summary" : "<p>This course contains small exercises...",
   4   │   "title" : "Learn Rust",
   5   │   "programming_language" : "Rust",
   6   │   "generated_edu_id": "Rustlings_JetBrains_Rust",
   7   │   "language" : "en",
   8   │   "course_type" : "Marketplace",
   9   │   "vendor" : {
  10   │     "name" : "JetBrains"
  11   │   },
  12   │   "items" : [
  13   │     {
  14   │       "id" : 103435,
  15   │       "title" : "Introduction",
  16   │       "items" : [
  17   │         {
  18   │           "id" : 271619,
  19   │           "title" : "Getting started",
  20   │           "task_list" : [
  21   │             {
  22   │               "id" : 1022919,
  23   │               "name" : "About",
  24   │               "files" : {
  25   │                 "src/main.rs" : {
...
  42   │             },
...
 209   │             {
 210   │               "id" : 904933,
 211   │               "name" : "Hello World",
 212   │               "custom_name" : "Task: Hello World",
 213   │               "files" : {
 214   │                 "src/main.rs" : {
 215   │                   "name" : "src/main.rs",
 216   │                   "placeholders" : [
 217   │                     {
 218   │                       "offset" : 16,
 219   │                       "length" : 34,
 220   │                       "possible_answer" : "Ru/F09ZLSjpRk8JyOzlg3zy/K9iooZ3oix6M1X32A/s=",
 221   │                       "placeholder_text" : "// put your code here to launch it"
 222   │                     }
 223   │                   ],
 224   │                   "is_visible" : true,
 225   │                   "text" : "sl3O59VlDkdl7u9JaiP8DD+0EgQzJURpAtp3AV+Um89rcWd5gdKO7LlRr24qR/gwiWi9yZxjRxgJiNUw/0J0Mg=="
 226   │                 },
 227   │                 "Cargo.toml" : {
 228   │                   "name" : "Cargo.toml",
 229   │                   "placeholders" : [ ],
 230   │                   "is_visible" : false,
 231   │                   "text" : "m9XZNRB4SP+Ysnl4An4VfJWhkF38c7t1Em1U+duEC1fsEagvwgmBfdPeIQrt4cB9NY/p54vj5bvesZ4/Z20zg155aoHEKp+ilJOp
       │ yaQrZWey+kxFjfvkvlCjq3Qy5LHQW4zOEhwAP1Ls7V/cD0HKAw=="
 232   │                 },
 233   │                 "tests/tests.rs" : {
 234   │                   "name" : "tests/tests.rs",
 235   │                   "placeholders" : [ ],
 236   │                   "is_visible" : false,
 237   │                   "text" : "46zQdc7odwehfbcrX7vQ3pqdVI77buRnnvEyd1NYaqhohdn25jZwHAq7bGVNFRDLaaOyApDE9jtZ/RjuIIy8SEweahmiv+q9GfxL
       │ QvV1BO1xuKS6Rttmfa1DBDW+PjhMyk1X+UyVwVGkViJsrE3Q+IJK1lKJaUWOb9zUEYoJz0hr/LfAP46t0xcmoEHS37JiiClKt/g6EE4g/NigDMLZ/b7dOXO5nyiJGfO3
       │ n2TNSofOE+SxBUHrDkjKZ5fAthlGqF75/Xpk08UeHk+g7Uz5fzM9NIk+9vyOnb52maGJwuZlUow6lmCxSMkridOa3RACzUxc+kegZHs71z0Vl98kIG9aM6bDNNqL1jhS
       │ AUjCbH5RatUN9IQCJ2T5ZxYUkhvNx745Gw76zyL2lEBfmQrWnodQPKW9dKba1tY71bvMTa64kNJxR77B5MmaYxPaYlN4KCQO0IrVFwLkj8vzbaQQZH/jmkG/0ArMQkQn
       │ ZjaokdriulKwsfhLWd1QC8a1gRAU2VDRCYzt+o6QSVrareoMZiZMYjMoNnTKo5sFgOqeIV5c0D4UZtmqiXm/elxP7S5sn3a639/YzkdxpnZO9C2eBRstQEx8XBQxqOTD
       │ SgGwo5wwcVuUf2//lVHQoKEl8oafNvVLJmzUNWmqdSL6B94V5+ASEnb3XOSU+Fq9ZmsTydzgfU53fLMkNIErk5aC3BBLm+34uMYda/tPIexCg3vD7blsrkLN5M2cwcE5
       │ nJzI87qemA4XVLUflZOvkfKAjBFozrY7ddf2unf82vSAJeHk+IFXTrt8p8pXUyMKImFqLXmIyiTbs2f2HRByoBiNx4dV36dJI1SKoNMMq/5BkhRxG399+T0BDZXjG3Ll
       │ WSLde2f431Y+B14J1QYP2jbijXGmN/zZYXnM+yMFrfu9r8UAz+PEyg5yVhWYGE3JvjpTOj8oS3Nxb9r6aLQuELDZrEhhgJ71oPO0D1qo6RTdz4LfViTAwUaZt1yEXcpT
       │ 5o5Rvuil85JsvBtjSDxdkRR9Nbvx"
 238   │                 }
 239   │               },
 240   │               "description_text" : "## Hello, World!\n\nNow, let’s write...",
 241   │               "description_format" : "MD",
 242   │               "feedback_link" : "https://docs.google.com/forms/d/e/1FAIpQLSdfJQgjsbDA4pPGpklj3vJnKNspd9wmEHzAgh6EkoJy2IiRuw/view
       │ form?usp=pp_url&entry.2103429047=Introduction+/+Getting+started+/+Hello+World",
 243   │               "task_type" : "edu"
 244   │             },
...

@airvzxf
Copy link

airvzxf commented Jun 12, 2023

I copied all the files and content from this repository to the created folder by JetBrains Academy, and it didn't work.

I copy only the test*.rs files and it is much better. For this command, I had both folders under the same directory: ./Learn Rust (it is the created folder for JetBrains Academy) and ./rustlings-course which is this repository.

❯ ls -lha
drwxr-xr-x wolf users 4.0 KB Sun Jun 11 23:22:27 2023  .
drwxr-xr-x wolf users  20 KB Mon Jun 12 00:20:07 2023  ..
drwxr-xr-x wolf users 4.0 KB Mon Jun 12 00:46:56 2023  Learn Rust
drwxr-xr-x wolf users 4.0 KB Sun Jun 11 23:52:10 2023  rustlings-course
cd ./rustlings-course
find . -type f -iname "*test*\.rs" -exec cp -r --parents {} ../Learn\ Rust \;
cd ..

Next problem: every time I click the check button, it runs this command:

/home/wolf/.cargo/bin/cargo test --message-format=json-diagnostic-rendered-ansi --no-run --color never --manifest-path "/home/wolf/Downloads/rust/Learn Rust/Introduction/Getting started/Hello World/Cargo.toml"

It will never run the test because this command has a parameter for “not run”.

Screenshot_2023-06-12_00-15-40

Furthermore, every time the check button is tapped, the test files copied from this repository are returned to empty files.


On the other hand, if you try to run in the Cargo in the CLion as the tutorial of this manual shows in the Introduction section, then it is working, but it doesn't make the check in the course.

Not forget to copy the test files from this repository:

cd ./rustlings-course
find . -type f -iname "*test*\.rs" -exec cp -r --parents {} ../Learn\ Rust \;
cd ..

Screenshot_2023-06-12_00-59-56

/home/wolf/.cargo/bin/cargo test --color=always --test tests --manifest-path "/home/wolf/Downloads/rust/Learn Rust/Introduction/Getting started/Hello World/Cargo.toml"

The output is:

warning: unused import: `PanicInfo`
 --> Introduction/Getting started/Hello World/tests/tests.rs:3:18
  |
3 | use std::panic::{PanicInfo};
  |                  ^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `std::fmt`
 --> Introduction/Getting started/Hello World/tests/tests.rs:4:5
  |
4 | use std::fmt;
  |     ^^^^^^^^

warning: `hello_world` (test "tests") generated 2 warnings (run `cargo fix --test "tests"` to apply 2 suggestions)
    Finished test [unoptimized + debuginfo] target(s) in 0.06s
     Running tests/tests.rs (/home/wolf/Downloads/rust/Learn Rust/target/debug/deps/tests-ae97527a26e2926b)

running 1 test
test prints_hello_world_and_starts_new_line ... FAILED

failures:

---- prints_hello_world_and_starts_new_line stdout ----
thread 'prints_hello_world_and_starts_new_line' panicked at 'assertion failed: `(left == right)`
  left: `"Hello, Rust!\n"`,
 right: `"Hello, world!\n"`: The output was incorrect:', Introduction/Getting started/Hello World/tests/tests.rs:22:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    prints_hello_world_and_starts_new_line

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s

error: test failed, to rerun pass `--test tests`

This screen is when all is good using the Cargo tool view.

Screenshot_2023-06-12_01-17-39


Final note:

I don't know exactly what is the problem or problems, but I hope that this little research helps to fix this course. I am very exciting about completing it, but if every time I tap the check button it didn't work, at some time is a little frustrating.

@Xmarmalade
Copy link

same question on IDEA 2023.2 and 2023.1.5

@sofiiako
Copy link
Contributor

sofiiako commented Aug 7, 2023

@DaniilBogdanovJB could you please take a look at this? all the earlier unassigned issues seem to be somehow related

@DaniilBogdanovJB
Copy link

Hello there,
I had no luck reproducing this problem on the latest IDEA and CLion (both community and Ultimate) on Win, Linux, and MacOS.

Please try removing the course project folder, re-downloading it from the Academy Marketplace, and checking if the problem is still reproducible.

@airvzxf
Copy link

airvzxf commented Aug 15, 2023

It is true, it is working. Maybe some fix from this repository or the rustlings-course, or some fix from JetBrains IDEs.

I tested this morning (9 hours ago) and it is working. In a few days or weeks, I'll format my computer and re-install Arch Linux, I'll test again and provide comments on this issue.


                   -`
                  .o+`                 wolf@MSIGT73EVR7RF
                 `ooo/                 OS: Arch Linux
                `+oooo:                Kernel: x86_64 Linux 6.4.10-arch1-1
               `+oooooo:               Uptime: 2d 5h 42m
               -+oooooo+:              Packages: 1920
             `/:-:++oooo+:             Shell: zsh 5.9
            `/++++/+++++++:            Resolution: 1920x1080
           `/++++++++++++++:           WM: OpenBox
          `/+++ooooooooooooo/`         WM Theme: Onyx-Citrus
         ./ooosssso++osssssso+`        GTK Theme: Adwaita [GTK3]
        .oossssso-````/ossssss+`       Disk: 385G / 469G (87%)
       -osssssso.      :ssssssso.      CPU: Intel Core i7-7820HK @ 8x 3.9GHz [48.0°C]
      :osssssss/        osssso+++.     GPU: NVIDIA GeForce GTX 1080
     /ossssssss/        +ssssooo/-     RAM: 18243MiB / 64262MiB
   `/ossssso+/:-        -:/+osssso+-
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/
 .`                                 `/

Attached the evidence.
Screenshot_2023-08-15_16-42-40
Screenshot_2023-08-15_16-43-08
Screenshot_2023-08-15_16-45-29

@Xmarmalade
Copy link

Xmarmalade commented Aug 29, 2023

After I updated IDEA and recreated the project, the tests are still not available.

IntelliJ IDEA 2023.2.1 (Ultimate Edition)
Build #IU-232.9559.62, built on August 23, 2023

image

I tried 'Repair IDE' , but this doesn't seem to work

@Xmarmalade
Copy link

After deleting all data related to JetBrains IDE: %APPDATA%/JetBrains and %LOCALAPPDATA%/JetBrains, my test function finally works
image

@DaniilBogdanovJB
Copy link

We found some an interesting detail regarding this issue:
If you disable "Show test results in the Test tool window" in Settings | Advanced Settings | Rust the error becomes reproducible with every test. IDE suggests toggling off this setting sometimes.
Removing the config directory (hard reset) or enabling it again restores functionality, so if anyone meets this problem - first try checking this setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants